Ich arbeite an einem älteren Projekt in Eclipse und muss die Google Play-Dienste, insbesondere Analytics und Admob, aktualisieren.NoClassDefFoundError mit Google Play Services 9.2.0 (Admob)
Beim Versuch, 9.2.0 den alten Weg zu bekommen, indem Sie die JAR-Datei aus dem Android SDK /extras/
Ordner kopieren, habe ich festgestellt, dass dies nicht mehr möglich ist, weil Google zu AAR-Dateien wechselt, die Android Studio unterstützen.
Ich fand this GitHub project mit allen Google Play Service AAR-Module in einzelne Android-Projekte erweitert. Ich habe die entsprechenden Projekte für Analytics und Admob wie hier angegeben heruntergeladen und importiert (https://github.com/dandar3/android-google-play-services-README).
Mein Projekt wird erfolgreich kompiliert, ohne Fehler, so dass alle Klassen zugänglich und ordnungsgemäß verknüpft sind.
jedoch auf auf meinem Nexus startet 5 Android 6.0.1 läuft ich dies ständig beim Start erhalten:
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)
Linie 102 bezieht sich auf das, was beim Start auftritt:
AdRequest adRequest = new AdRequest.Builder().build();
Aus meiner Forschung, alles, was ich sehe, sind Verweise auf einen (alten) Fehler, der Gingerbread Gerät betroffen s, aber ich glaube nicht, dass das hier gilt.
Edit: Meine build.gradle Datei wie gewünscht. Nicht sicher, ob relevant, da ich verwende nicht eine Abhängigkeit der Google Play-Dienste zu verbinden, aber hier ist es trotzdem:
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"
}
Könnten Sie Ihre Gradle-Datei posten? – nitinsh99
@ nitinsh99 Sicher, meine Frage damit bearbeitet. – FTLRalph
Könnten Sie versuchen, Folgendes hinzuzufügen: kompilieren Sie "com.google.firebase: firebase-ads: 9.0.0" in Ihren Abhängigkeiten? Stellen Sie sicher, dass Sie Ihr Projekt säubern und die Groß- und Kleinschreibung neu synchronisieren. – nitinsh99