gpt4 book ai didi

java - Google Play 服务 9.2.0 (Admob) 的 NoClassDefFoundError

转载 作者:太空狗 更新时间:2023-10-29 14:47:30 26 4
gpt4 key购买 nike

我正在 Eclipse 中处理遗留项目,需要更新 Google Play 服务,特别是 Analytics 和 Admob。

在尝试通过从 Android SDK /extras/ 文件夹复制 JAR 文件以旧方式获取 9.2.0 时,我发现由于 Google 切换到支持 Android 的 AAR 文件而不再可能工作室。

我找到了 this GitHub project将所有 Google Play 服务 AAR 模块扩展到单独的 Android 项目中。我已经下载并导入了适用于 Analytics 和 Admob 的项目,如此处所示 (https://github.com/dandar3/android-google-play-services-README)。

我的项目编译成功,没有错误,因此所有类都可以访问并正确链接。

但是,在运行 Android 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)

第102行是指这个,发生在启动时:

AdRequest adRequest = new AdRequest.Builder().build();

根据我的研究,我所看到的只是对影响 Gingerbread 设备的(旧)错误的引用,但我认为这不适用于此处。


编辑我的 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-basement”添加为我的项目的依赖项并且一切正常。没有意识到我需要将其作为依赖项直接添加到我自己的项目中,因为 admob/analytics 项目也隐式添加了它。

关于java - Google Play 服务 9.2.0 (Admob) 的 NoClassDefFoundError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38296457/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com