I am using Maven to build my android project. In my Android project pom.xml, I have defined the dependency of google-play-service:
<dependency>
<groupId>com.google.android.gms</groupId>
<artifactId>google-play-services</artifactId>
<type>apklib</type>
<version>7</version>
<scope>provided</scope>
</dependency>
My project was built successfully. The android device I am using also has Google Play app installed. But when I start my app, I constantly get 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 could be the reason for this error? How to fix it?
I would highly suggest using Gradle
over Maven
.
However, make sure you using the correct import:
com.google.android.gms:play-services-ads:7.5.0
ArtifactID
and Version
:<dependency>
<groupId>com.google.android.gms</groupId>
<artifactId>play-services-ads</artifactId>
<version>7.5.0</version>
<type>apklib</type>
</dependency>
Docs: https://developers.google.com/android/guides/setup
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With