Skip to content Skip to sidebar Skip to footer

Android Compilation Error After Upgrading To 'com.google.android.gms:play-services-ads:18.1.0'

I am upgrading my play-services-ads library from version 12 to version 18.1: dependencies { api 'com.google.android.gms:play-services-ads:18.1.0' } The problem is that the com

Solution 1:

com.google.android.gms:play-services-ads:18.1.0 depends upon com.google.android.gms:play-services-ads-identifier:17.0.0, among other libraries.

Your error indicates that com.google.android.gms:play-services-ads-identifier:17.0.0 references javax.annotation.concurrent.GuardedBy. However, that class is not in the Android SDK. The POM file for com.google.android.gms:play-services-ads-identifier:17.0.0 should be referencing a library that has an implementation of that class, but it does not seem to.

One library that has an implementation of that class is com.google.code.findbugs:jsr305. Adding a dependency on com.google.code.findbugs:jsr305 for a recent version (e.g., 3.0.2) gave you that class, satisfying the compiler.

So, there appears to be a bug in the Play Services SDK packaging, which my workaround resolves. You might want to add a comment in your module's build.gradle file to consider removing the com.google.code.findbugs:jsr305 if a future update to com.google.android.gms:play-services-ads fixes this bug.

Post a Comment for "Android Compilation Error After Upgrading To 'com.google.android.gms:play-services-ads:18.1.0'"