Android Studio, Google Adwords API and dependencies

44 views
Skip to first unread message

goldenmaza

unread,
Mar 2, 2018, 4:34:06 AM3/2/18
to AdWords API Forum
I have a problem resolving my dependencies and as always the official sources lack the details required to solve this problem and/or why certain
things might occur. Online guides have given examples of Eclipse and Maven, but since I neither sit with Eclipse or deal with Maven that
often I have no clue what to do.

In my project I would like to use the Google AdWords API, and I'm sitting with Android Studio 3.0.1, to do this I have tried the following:


1) Placed the Google API Client (+ Android, just incase) jar files under app/libs directory (name.jar + name-sources.jar).


2) The build.gradle file, under the app directory, have the following line under dependencies: implementation 'com.google.api-client:google-api-client:1.23.0'


3) Same gradle file has the following as well, as that seemed to have solved a similar issue before:

    android {
        buildTypes
{
            debug
{ ... } // same content...
            release
{ ... } // ...under both
       
}
   
}


4) Both build.gradle files (app and project) have the following in their respective locations (three different locations):

    repositories {
        jcenter
()
        google
()
   
}


I continue having this problem regardless of what I try, once the third bullet above fixed a similar issue however, but not in this case and I still get the following:

Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.google.api-client:google-api-client:1.23.0. Open File Show Details

Unable to resolve dependency for ':app@release/compileClasspath': Could not resolve com.google.api-client:google-api-client:1.23.0. Open File Show Details


Under my class, as a result of the above, it can not find the following (one of many):

import com.google.api.ads.adwords.axis.v201710.cm.AdGroupAdServiceInterface;




What am I missing in this case?

Dhanya Sundararaju (AdWords API Team)

unread,
Mar 2, 2018, 2:37:10 PM3/2/18
to AdWords API Forum
Hi,

Since the issue you are facing is around dependencies, could you please download the 'AdWords jars and examples' download(which already contains the dependencies) in this section of the client library and retry installation? Also, is there any specific reason that you are using Android Studio and not eclipse/maven?

Regards,
Dhanya, AdWords API Team

goldenmaza

unread,
Mar 4, 2018, 3:51:15 PM3/4/18
to AdWords API Forum
Hello Dhanya

Thank you for helping me! :)

Do I really need everything in this 'jars and examples' archive? I just want to be able to load data from the AdWords API (AdWordsSession, AdWordsServicesInterface,
Credential, OfflineCredentials.Builder, AdWordsSession.Builder, AdGroupAdServiceInterface, SelectorBuilder, Selector, AdCampaign, AdGroup, AdGroupAd etc). I have no
need/interest in updating/removing data under AdWords API, or other API services for that matter.

I've no longer problems with my dependencies, but with these files, do I still need any of the stated dependencies under the gradle.build file?

Why am I not using Eclipse? In my career I develop with IntelliJ and with my private Android projects I sit with Android Studio. When I started on my second
project, as I prefer working on projects in parallel (not to get bored or stumped at times), I just created another Android Studio project instead of getting a third IDE
on the same workstation and for the time being Android Studio is enough for what I have to do.

Thank you for your help! =o]

Kind regards
Richard

Dhanya Sundararaju (AdWords API Team)

unread,
Mar 5, 2018, 1:08:56 PM3/5/18
to AdWords API Forum
Hi Richard,

If your issues regarding dependencies have been resolved by installing the 'AdWords jars and examples' download, I would suggest leaving the stated dependencies as is, in the gradle.build, unless you have a pressing need to, otherwise. In that case, you could just keep the ones that would help you in the easy management of credentials, authentication, and session information. Please let me know if you have further questions.
Reply all
Reply to author
Forward
0 new messages