AdMob 导致:无法获取提供程序 com.google.android.gms.ads.MobileAdsInitProvider:java.lang.ClassNotFoundException

COY*_*OYG 2 android admob classnotfoundexception

我正在尝试实施 adMob,但我的应用程序没有启动并提供以下错误:

java.lang.RuntimeException: Unable to get provider com.google.android.gms.ads.MobileAdsInitProvider: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.ads.MobileAdsInitProvider" on path: DexPathList[[zip file "/data/app/com.aaron.derrystudios.wordresolver-mOF2EngPcA5nT8dd27zx5g==/base.apk"],nativeLibraryDirectories=[/data/app/com.aaron.derrystudios.wordresolver-mOF2EngPcA5nT8dd27zx5g==/lib/arm64, /system/lib64]]
    at android.app.ActivityThread.installProvider(ActivityThread.java:7369)
    at android.app.ActivityThread.installContentProviders(ActivityThread.java:6909)
    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6826)
    at android.app.ActivityThread.access$1400(ActivityThread.java:267)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1981)
    at android.os.Handler.dispatchMessage(Handler.java:107)
    at android.os.Looper.loop(Looper.java:237)
    at android.app.ActivityThread.main(ActivityThread.java:7762)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1047)
 Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.ads.MobileAdsInitProvider" on path: DexPathList[[zip file "/data/app/com.aaron.derrystudios.wordresolver-mOF2EngPcA5nT8dd27zx5g==/base.apk"],nativeLibraryDirectories=[/data/app/com.aaron.derrystudios.wordresolver-mOF2EngPcA5nT8dd27zx5g==/lib/arm64, /system/lib64]]
    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:196)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
    at android.app.AppComponentFactory.instantiateProvider(AppComponentFactory.java:147)
    at android.app.ActivityThread.installProvider(ActivityThread.java:7353)
    at android.app.ActivityThread.installContentProviders(ActivityThread.java:6909) 
    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6826) 
    at android.app.ActivityThread.access$1400(ActivityThread.java:267) 
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1981) 
    at android.os.Handler.dispatchMessage(Handler.java:107) 
    at android.os.Looper.loop(Looper.java:237) 
    at android.app.ActivityThread.main(ActivityThread.java:7762) 
    at java.lang.reflect.Method.invoke(Native Method) 
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) 
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1047) 
    Suppressed: java.io.IOException: Failed to open dex files from /data/app/com.aaron.derrystudios.wordresolver-mOF2EngPcA5nT8dd27zx5g==/base.apk because: Bad encoded_array value: Failure to verify dex file '/data/app/com.aaron.derrystudios.wordresolver-mOF2EngPcA5nT8dd27zx5g==/base.apk': Bad encoded_value method type size 7
    at dalvik.system.DexFile.openDexFileNative(Native Method)
    at dalvik.system.DexFile.openDexFile(DexFile.java:365)
    at dalvik.system.DexFile.<init>(DexFile.java:107)
    at dalvik.system.DexFile.<init>(DexFile.java:80)
    at dalvik.system.DexPathList.loadDexFile(DexPathList.java:444)
    at dalvik.system.DexPathList.makeDexElements(DexPathList.java:403)
    at dalvik.system.DexPathList.<init>(DexPathList.java:164)
    at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:126)
    at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:101)
    at dalvik.system.PathClassLoader.<init>(PathClassLoader.java:74)
    at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:87)
    at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:116)
    at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:114)
    at android.app.ApplicationLoaders.getClassLoaderWithSharedLibraries(ApplicationLoaders.java:60)
    at android.app.LoadedApk.createOrUpdateClassLoaderLocked(LoadedApk.java:892)
    at android.app.LoadedApk.getClassLoader(LoadedApk.java:991)
    at android.app.LoadedApk.getResources(LoadedApk.java:1248)
    at android.app.ContextImpl.createAppContext(ContextImpl.java:2614)
    at android.app.ContextImpl.createAppContext(ContextImpl.java:2606)
    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6724)
            ... 8 more
Run Code Online (Sandbox Code Playgroud)

我搜索了这个问题,所有的解决方案,像这样,都说你现在需要在清单中提供从 adMob 提供的 App ID。我已经对此进行了三次检查,并且在meta-data标签下的清单中提供了正确的应用程序 ID,如下所示:

应用程序

我一直在关注这个官方指南并重复了两次,但我仍然遇到这个错误。

我还为 Android 横幅使用了专用的测试广告单元 ID,所以我认为这不是问题所在。

还有什么可能导致这种情况?

une*_*yer 7

我遇到了类似的错误,这解决了它。

In biuld.gradle (Module) 
android { 
 ...
 compileOptions {
  sourceCompatibility = 1.8
  targetCompatibility = 1.8
 }
}
Run Code Online (Sandbox Code Playgroud)


归档时间:

查看次数:

3363 次

最近记录:

6 年,1 月 前