Adwords and Analytics APIs conflict

135 views
Skip to first unread message

davidr...@gmail.com

unread,
Oct 26, 2017, 11:32:17 AM10/26/17
to AdWords API Forum
Hi,
I am working on a Maven project, so I have both dependencies:
        <dependency>
            <groupId>com.google.apis</groupId>
            <artifactId>google-api-services-analyticsreporting</artifactId>
            <version>v4-rev116-1.23.0</version>
        </dependency>
        <dependency>
          <groupId>com.google.api-ads</groupId>
          <artifactId>adwords-axis</artifactId>
          <version>3.9.0</version>
        </dependency>

My Adwords API project was working correctly until I added my code to the main project which has the Analytics API.
Now, I am getting this error:

Exception in thread "main" java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkNotNull(Ljava/lang/Object;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object;
    at com.google.api.ads.common.lib.auth.OfflineCredentials$Api.<init>(OfflineCredentials.java:89)
    at com.google.api.ads.common.lib.auth.OfflineCredentials$Api.<clinit>(OfflineCredentials.java:81)
    at aleph.dataconnectors.google.adwords.AdwordsArchiver.getCredentials(AdwordsArchiver.java:108)
    at aleph.dataconnectors.google.adwords.AdwordsArchiver.processReports(AdwordsArchiver.java:191)
    at aleph.dataconnectors.google.adwords.Runner.main(Runner.java:14)

If I comment out the "analytics" API then it works correctly. So I assume there is a conflict between both APIs.
BTW I got the error when my code is in this section:

Credential oAuth2Credential = new OfflineCredentials.Builder()
            .forApi(Api.ADWORDS)
            .fromFile()
            .build()
            .generateCredential();

Also I tried replacing the "credentials file" with "strings" (just for testing) but I am still having the same problem
            .withClientSecrets(clientId, clientSecret)
            .withRefreshToken(refreshToken)

Any ideas how to solve this conflict?
Thanks
-David

Shwetha Vastrad (AdWords API Team)

unread,
Oct 26, 2017, 1:40:04 PM10/26/17
to AdWords API Forum
Hi David, 

It could be due to a conflict in the underlying dependencies. Since this is related to the AdWords API Java client library, I would suggest that you post your question on the library's issue tracker so the library owners can help you out. 

Regards.
Shwetha, AdWords API Team. 
Reply all
Reply to author
Forward
0 new messages