Didn't find class "com.google.android.gms.ads.identifier.AdvertisingIdClient"

I am using Maven to build my android project. In my android pom.xml project, I have defined a google-play service dependency:



My project has been successfully created. The Android device I am using also has the Google Play app installed. But when I run my application, I keep getting the following error :

Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.ads.identifier.AdvertisingIdClient" on path: DexPathList[[zip file "/data/app/com.my.app-1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:469)


What is the reason for this error? How to fix it?


source to share

1 answer

I would suggest using Gradle

over Maven


However, make sure you are using the correct imports:


Updated ArtifactID

and Version




Docs : https://developers.google.com/android/guides/setup



All Articles