gpt4 book ai didi

Android:在路径上找不到类 "com.google.android.gms.ads.AdActivity"

转载 作者:搜寻专家 更新时间:2023-11-01 08:52:27 25 4
gpt4 key购买 nike

我在 Google Play 开发者控制台和 Google Analytics 中收到以下崩溃报告:

java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.myapp.package.here/com.google.android.gms.ads.AdActivity}: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.ads.AdActivity" on path: DexPathList[[zip file "/data/app/com.myapp.package.here-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.myapp.package.here-1, /vendor/lib, /system/lib]]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2121)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
at android.app.ActivityThread.access$800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.ads.AdActivity" on path: DexPathList[[zip file "/data/app/com.myapp.package.here-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.myapp.package.here-1, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2112)
... 11 more

我正在使用此处记录的最新 AdMob(通过 Google Play 服务库)API: https://developers.google.com/mobile-ads-sdk/docs/

配置的相关部分:

<application...>
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />

<activity android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />

布局 xml:

  <com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adSize="SMART_BANNER"
ads:adUnitId="@string/adMobUnitId" />

代码:

//onCreate()...
try {
adView = (AdView) activity.findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().addTestDevice(AdRequest.DEVICE_ID_EMULATOR).build();
adView.loadAd(adRequest);
} catch (Exception e) {
Log.e("AdManager", "Unable to load ads", e);
}



//onResume()
adview.resume()

看起来这只发生在一些设备上,并且在我有权访问的模拟器和真实设备上工作正常。

According to Google AdMob Ads Developer group新的 AdMob SDK 应该可以在设备上运行,即使它没有安装 Google Play(顺便说一下,一份崩溃报告来自 Nexus7 2013 库存)。所以我认为这不是问题...

另外,从广告加载代码中可以看出,它位于 try/catch 中,看起来这个异常甚至在我的代码执行之前就发生了。这也可以从异常堆栈跟踪中看到(我的应用程序包中没有行)

有人知道可能是什么问题吗?感谢您的帮助!

最佳答案

将 Google Play 服务库更新到最新版本后,问题似乎已解决。

关于Android:在路径上找不到类 "com.google.android.gms.ads.AdActivity",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21885866/

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