没有';“找不到类”;com.google.android.gms.ads.identifier.AdvertisingIdClient“;
我正在使用Maven构建我的android项目。在我的Android项目pom.xml中,我定义了google play服务的依赖关系:没有';“找不到类”;com.google.android.gms.ads.identifier.AdvertisingIdClient“;,android,maven,google-play,google-play-services,google-advertising-id,Android,Maven,Google Play,Google Play Services,Google Advertising Id,我正在使用Maven构建我的android项目。在我的Android项目pom.xml中,我定义了google play服务的依赖关系: <dependency> <groupId>com.google.android.gms</groupId> <artifactId>google-play-services</artifactId> <type>apklib</type> <versio
<dependency>
<groupId>com.google.android.gms</groupId>
<artifactId>google-play-services</artifactId>
<type>apklib</type>
<version>7</version>
<scope>provided</scope>
</dependency>
这一错误的原因可能是什么?如何修复它?我强烈建议使用
Gradle
而不是Maven
但是,请确保使用正确的导入:
com.google.android.gms:play服务广告:7.5.0
更新了ArtifactID
和版本
:
com.google.android.gms
谢谢。但是我需要使用maven,因为它是我们遗留项目的一部分,这是我的问题的前提。@user842225为什么会被否决?我确实回答了你的问题,现在情况如何?
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)
<dependency>
<groupId>com.google.android.gms</groupId>
<artifactId>play-services-ads</artifactId>
<version>7.5.0</version>
<type>apklib</type>
</dependency>