Java Google Play Services 9.2.0(Admob)的NoClassDefFoundError
我正在Eclipse中从事一个遗留项目,需要更新Google Play服务,特别是Analytics和Admob 在尝试通过从Android SDKJava Google Play Services 9.2.0(Admob)的NoClassDefFoundError,java,android,admob,google-play-services,proguard,Java,Android,Admob,Google Play Services,Proguard,我正在Eclipse中从事一个遗留项目,需要更新Google Play服务,特别是Analytics和Admob 在尝试通过从Android SDK/extras/文件夹复制JAR文件来获得9.2.0旧方法时,我发现这不再可能,因为Google切换到支持Android Studio的AAR文件 我发现所有的Google Play服务AAR模块都扩展到了单独的Android项目中。我已经下载并导入了用于分析和Admob的适当项目,如下所示() 我的项目成功编译,没有错误,因此所有类都可以访问并正确
/extras/
文件夹复制JAR文件来获得9.2.0旧方法时,我发现这不再可能,因为Google切换到支持Android Studio的AAR文件
我发现所有的Google Play服务AAR模块都扩展到了单独的Android项目中。我已经下载并导入了用于分析和Admob的适当项目,如下所示()
我的项目成功编译,没有错误,因此所有类都可以访问并正确链接
然而,当我在运行安卓6.0.1的Nexus 5上启动时,我会不断收到以下信息:
Rejecting re-init on previously-failed class java.lang.Class<com.google.android.gms.ads.internal.client.zze>
Rejecting re-init on previously-failed class java.lang.Class<com.google.android.gms.ads.internal.client.zze>
Rejecting re-init on previously-failed class java.lang.Class<com.google.android.gms.ads.internal.client.zze>
Shutting down VM
FATAL EXCEPTION: main
Process: com.example.app, PID: 22307
java.lang.NoClassDefFoundError: com.google.android.gms.ads.internal.client.zze
at com.google.android.gms.ads.internal.client.zzm.<init>(Unknown Source)
at com.google.android.gms.ads.internal.client.zzm.<clinit>(Unknown Source)
at com.google.android.gms.ads.internal.client.zzm.zziw(Unknown Source)
at com.google.android.gms.ads.internal.client.zzad.<clinit>(Unknown Source)
at com.google.android.gms.ads.AdRequest.<clinit>(Unknown Source)
at com.google.android.gms.ads.AdRequest$Builder.<init>(Unknown Source)
at com.example.AndroidLauncher$1.handleMessage(AndroidLauncher.java:102)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
AdRequest adRequest = new AdRequest.Builder().build();
从我的研究中,我所看到的只是一个(旧的)影响姜饼设备的缺陷,但我认为这不适用于这里
按要求编辑:我的build.gradle文件。不确定是否相关,因为我没有使用此链接将依赖项链接到Google Play服务,但它仍然存在:
buildscript {
repositories {
mavenCentral()
mavenLocal()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.1'
classpath 'org.robovm:robovm-gradle-plugin:1.11.0'
}
}
allprojects {
apply plugin: "eclipse"
apply plugin: "idea"
version = '1.0.0-SNAPSHOT'
ext {
appName = 'sticknodes'
gdxVersion = '1.5.5'
roboVMVersion = '1.14.0'
}
repositories {
mavenLocal()
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url "https://oss.sonatype.org/content/repositories/releases/" }
}
}
project(":desktop") {
apply plugin: "java"
dependencies {
compile project(":core")
compile "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
}
}
project(":android") {
apply plugin: "android"
configurations { natives }
dependencies {
compile project(":core")
compile "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"
}
}
project(":android-pro") {
apply plugin: "android"
configurations { natives }
dependencies {
compile project(":core")
compile "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"
}
}
project(":ios") {
apply plugin: "java"
apply plugin: "robovm"
configurations { natives }
dependencies {
compile project(":core")
compile "org.robovm:robovm-rt:${roboVMVersion}"
compile "org.robovm:robovm-cocoatouch:${roboVMVersion}"
compile "com.badlogicgames.gdx:gdx-backend-robovm:$gdxVersion"
compile "org.robovm:robopods-google-mobile-ads-ios:1.14.0"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-ios"
compile fileTree(dir: 'libs', include: '*.jar')
}
}
project(":ios-pro") {
apply plugin: "java"
apply plugin: "robovm"
configurations { natives }
dependencies {
compile project(":core")
compile "org.robovm:robovm-rt:${roboVMVersion}"
compile "org.robovm:robovm-cocoatouch:${roboVMVersion}"
compile "com.badlogicgames.gdx:gdx-backend-robovm:$gdxVersion"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-ios"
compile fileTree(dir: 'libs', include: '*.jar')
}
}
project(":core") {
apply plugin: "java"
dependencies {
compile "com.badlogicgames.gdx:gdx:$gdxVersion"
compile "com.googlecode.mp4parser:isoparser:1.1.14"
compile fileTree(dir: 'libs', include: '*.jar')
}
}
tasks.eclipse.doLast {
delete ".project"
}
所以第二天,我添加了Android库“play services Basic”作为我项目的依赖项,一切正常。没有意识到我需要将其作为依赖项直接添加到我自己的项目中,因为admob/analytics projects也隐式添加了它。您可以发布您的Gradle文件吗?@nitinsh99当然可以,用它编辑了我的问题。您可以尝试在依赖项中添加:compile“com.google.firebase:firebase ads:9.0.0”吗?确保清理您的项目并重新同步gradle。@nitinsh99我以前玩过这个。我按照你的建议做了,Gradle没有下载任何新的东西。所以我把
com.android.tools.build:gradle
从1.3.1改为2.0.0。现在,在尝试刷新Gradle依赖项时,它只给了我一个错误:按照错误所说的那样,继续更改包装器版本,必须清理一些其他内容以使其刷新依赖项。仍然没有下载任何新内容,所以project只是显示“无法解析为类型”错误。