我使用AdMob在我的应用中显示插页式广告,并在加载广告时抛出异常。我不明白这个例外。
应用启动时,我按如下方式加载广告:
InterstitialAd ad = new InterstitialAd( context );
ad.setAdUnitId( "ca-app-pub-some-id" );
AdRequest adRequest = new AdRequest.Builder().build();
ad.loadAd( adRequest ); // this line throws the exception
调用loadAd()
时,logcat中会显示以下消息:
10-28 21:53:18.965 22950 22950 W System : ClassLoader referenced unknown path: /data/user/0/com.google.android.gms/app_chimera/m/0000000c/n/armeabi
10-28 21:53:18.976 22950 22950 D DynamitePackage: Instantiated singleton DynamitePackage.
10-28 21:53:18.976 22950 22950 D DynamitePackage: Instantiating com.google.android.gms.ads.ChimeraAdManagerCreatorImpl
10-28 21:53:19.187 22950 22996 W System : ClassLoader referenced unknown path:
10-28 21:53:19.196 22950 22996 I DynamiteModule: Considering local module com.google.android.gms.piccard.dynamite:0 and remote module com.google.android.gms.piccard.dynamite:6
10-28 21:53:19.196 22950 22996 I DynamiteModule: Selected remote version of com.google.android.gms.piccard.dynamite, version >= 6
10-28 21:53:19.219 22950 22950 I WebViewFactory: Loading com.android.chrome version 54.0.2840.68 (code 284006852)
10-28 21:53:19.233 22950 22997 I art : Rejecting re-init on previously-failed class java.lang.Class<abd>: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/chimera/Fragment;
10-28 21:53:19.233 22950 22997 I art : at java.lang.Class dalvik.system.DexFile.defineClassNative(java.lang.String, java.lang.ClassLoader, java.lang.Object, dalvik.system.DexFile) (DexFile.java:-2)
10-28 21:53:19.233 22950 22997 I art : at java.lang.Class dalvik.system.DexFile.defineClass(java.lang.String, java.lang.ClassLoader, java.lang.Object, dalvik.system.DexFile, java.util.List) (DexFile.java:299)
10-28 21:53:19.233 22950 22997 I art : at java.lang.Class dalvik.system.DexFile.loadClassBinaryName(java.lang.String, java.lang.ClassLoader, java.util.List) (DexFile.java:292)
10-28 21:53:19.233 22950 22997 I art : at java.lang.Class dalvik.system.DexPathList.findClass(java.lang.String, java.util.List) (DexPathList.java:418)
10-28 21:53:19.233 22950 22997 I art : at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:54)
10-28 21:53:19.233 22950 22997 I art : at java.lang.Class com.google.android.chimera.container.internal.DelegateLastPathClassLoader.loadClass(java.lang.String, boolean) (:com.google.android.gms:28)
10-28 21:53:19.233 22950 22997 I art : at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
10-28 21:53:19.233 22950 22997 I art : at hp hp.a(android.content.Context, java.lang.String, java.lang.String, boolean) (:com.google.android.gms.DynamiteModulesA:2618)
10-28 21:53:19.233 22950 22997 I art : at hp hg.b(android.content.Context, boolean) (:com.google.android.gms.DynamiteModulesA:130)
10-28 21:53:19.233 22950 22997 I art : at void hg.a(android.content.Context, boolean) (:com.google.android.gms.DynamiteModulesA:90)
10-28 21:53:19.234 22950 22997 I art : at hh hh.a(java.lang.String, android.content.Context, boolean) (:com.google.android.gms.DynamiteModulesA:80)
10-28 21:53:19.234 22950 22997 I art : at void com.google.android.gms.ads.internal.y.run() (:com.google.android.gms.DynamiteModulesA:5173)
10-28 21:53:19.234 22950 22997 I art : at java.lang.Object com.google.android.gms.ads.internal.util.y.call() (:com.google.android.gms.DynamiteModulesA:1055)
10-28 21:53:19.234 22950 22997 I art : at void com.google.android.gms.ads.internal.util.z.run() (:com.google.android.gms.DynamiteModulesA:75)
10-28 21:53:19.234 22950 22997 I art : at java.lang.Object java.util.concurrent.Executors$RunnableAdapter.call() (Executors.java:428)
10-28 21:53:19.234 22950 22997 I art : at void java.util.concurrent.FutureTask.run() (FutureTask.java:237)
10-28 21:53:19.234 22950 22997 I art : at void java.util.concurrent.ThreadPoolExecutor.runWorker(java.util.concurrent.ThreadPoolExecutor$Worker) (ThreadPoolExecutor.java:1133)
10-28 21:53:19.234 22950 22997 I art : at void java.util.concurrent.ThreadPoolExecutor$Worker.run() (ThreadPoolExecutor.java:607)
10-28 21:53:19.234 22950 22997 I art : at void java.lang.Thread.run() (Thread.java:761)
10-28 21:53:19.234 22950 22997 I art : Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.chimera.Fragment" on path: DexPathList[[zip file "/data/data/com.google.android.gms/app_chimera/m/0000000c/DynamiteModulesA_GmsCore_prodmnc_alldpi_release.apk"],nativeLibraryDirectories=[/data/user/0/com.google.android.gms/app_chimera/m/0000000c/n/armeabi-v7a, /data/user/0/com.google.android.gms/app_chimera/m/0000000c/n/armeabi, /system/lib, /vendor/lib]]
10-28 21:53:19.234 22950 22997 I art : at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:56)
10-28 21:53:19.234 22950 22997 I art : at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:380)
10-28 21:53:19.234 22950 22997 I art : at java.lang.Class com.google.android.chimera.container.internal.DelegateLastPathClassLoader.loadClass(java.lang.String, boolean) (:com.google.android.gms:34)
10-28 21:53:19.234 22950 22997 I art : at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
10-28 21:53:19.234 22950 22997 I art : at java.lang.Class dalvik.system.DexFile.defineClassNative(java.lang.String, java.lang.ClassLoader, java.lang.Object, dalvik.system.DexFile) (DexFile.java:-2)
10-28 21:53:19.234 22950 22997 I art : at java.lang.Class dalvik.system.DexFile.defineClass(java.lang.String, java.lang.ClassLoader, java.lang.Object, dalvik.system.DexFile, java.util.List) (DexFile.java:299)
10-28 21:53:19.234 22950 22997 I art : at java.lang.Class dalvik.system.DexFile.loadClassBinaryName(java.lang.String, java.lang.ClassLoader, java.util.List) (DexFile.java:292)
10-28 21:53:19.234 22950 22997 I art : at java.lang.Class dalvik.system.DexPathList.findClass(java.lang.String, java.util.List) (DexPathList.java:418)
10-28 21:53:19.234 22950 22997 I art : at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:54)
10-28 21:53:19.234 22950 22997 I art : at java.lang.Class com.google.android.chimera.container.internal.DelegateLastPathClassLoader.loadClass(java.lang.String, boolean) (:com.google.android.gms:28)
10-28 21:53:19.234 22950 22997 I art : at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
10-28 21:53:19.234 22950 22997 I art : at hp hp.a(android.content.Context, java.lang.String, java.lang.String, boolean) (:com.google.android.gms.DynamiteModulesA:2618)
10-28 21:53:19.234 22950 22997 I art : at hp hg.b(android.content.Context, boolean) (:com.google.android.gms.DynamiteModulesA:130)
10-28 21:53:19.234 22950 22997 I art : at void hg.a(android.content.Context, boolean) (:com.google.android.gms.DynamiteModulesA:90)
10-28 21:53:19.234 22950 22997 I art : at hh hh.a(java.lang.String, android.content.Context, boolean) (:com.google.android.gms.DynamiteModulesA:80)
10-28 21:53:19.234 22950 22997 I art : at void com.google.android.gms.ads.internal.y.run() (:com.google.android.gms.DynamiteModulesA:5173)
10-28 21:53:19.234 22950 22997 I art : at java.lang.Object com.google.android.gms.ads.internal.util.y.call() (:com.google.android.gms.DynamiteModulesA:1055)
10-28 21:53:19.234 22950 22997 I art : at void com.google.android.gms.ads.internal.util.z.run() (:com.google.android.gms.DynamiteModulesA:75)
10-28 21:53:19.234 22950 22997 I art : at java.lang.Object java.util.concurrent.Executors$RunnableAdapter.call() (Executors.java:428)
10-28 21:53:19.234 22950 22997 I art : at void java.util.concurrent.FutureTask.run() (FutureTask.java:237)
10-28 21:53:19.234 22950 22997 I art : at void java.util.concurrent.ThreadPoolExecutor.runWorker(java.util.concurrent.ThreadPoolExecutor$Worker) (ThreadPoolExecutor.java:1133)
10-28 21:53:19.234 22950 22997 I art : at void java.util.concurrent.ThreadPoolExecutor$Worker.run() (ThreadPoolExecutor.java:607)
10-28 21:53:19.234 22950 22997 I art : at void java.lang.Thread.run() (Thread.java:761)
10-28 21:53:19.234 22950 22997 I art :
10-28 21:53:19.309 22950 22996 W VideoCapabilities: Unrecognized profile 2130706433 for video/avc
10-28 21:53:19.371 22950 22997 W art : Before Android 4.1, method double java.util.concurrent.ThreadLocalRandom.internalNextDouble(double, double) would have incorrectly overridden the package-private method in java.util.Random
10-28 21:53:19.371 22950 22997 W art : Before Android 4.1, method int java.util.concurrent.ThreadLocalRandom.internalNextInt(int, int) would have incorrectly overridden the package-private method in java.util.Random
10-28 21:53:19.371 22950 22997 W art : Before Android 4.1, method long java.util.concurrent.ThreadLocalRandom.internalNextLong(long, long) would have incorrectly overridden the package-private method in java.util.Random
10-28 21:53:19.377 22950 22996 I VideoCapabilities: Unsupported profile 4 for video/mp4v-es
10-28 21:53:19.389 22950 22950 I cr_LibraryLoader: Time to load native libraries: 32 ms (timestamps 9522-9554)
10-28 21:53:19.390 22950 22950 I cr_LibraryLoader: Expected native library version number "54.0.2840.68", actual native library version number "54.0.2840.68"
10-28 21:53:19.519 22950 22950 I cr_LibraryLoader: Expected native library version number "54.0.2840.68", actual native library version number "54.0.2840.68"
10-28 21:53:19.526 22950 22950 I chromium: [INFO:library_loader_hooks.cc(151)] Chromium logging enabled: level = 0, default verbosity = 0
10-28 21:53:19.597 22950 22950 I cr_BrowserStartup: Initializing chromium process, singleProcess=true
10-28 21:53:19.693 22950 22950 I Adreno : QUALCOMM build : 74df444, I409c65498b
10-28 21:53:19.693 22950 22950 I Adreno : Build Date : 06/22/16
10-28 21:53:19.693 22950 22950 I Adreno : OpenGL ES Shader Compiler Version: XE031.08.00.02
10-28 21:53:19.693 22950 22950 I Adreno : Local Branch : N16
10-28 21:53:19.693 22950 22950 I Adreno : Remote Branch :
10-28 21:53:19.693 22950 22950 I Adreno : Remote Branch :
10-28 21:53:19.693 22950 22950 I Adreno : Reconstruct Branch :
10-28 21:53:19.957 22950 22950 I Ads : Starting ad request.
我认为这将是一个缺少的依赖,但我无法确定我应该添加到我的Gradle文件的库。依赖项中的当前库是:
compile 'com.google.android.gms:play-services-ads:9+'
compile 'net.hockeyapp.android:HockeySDK:4.1.1'
compile "org.apache.httpcomponents:httpmime:4.2.3"
compile 'com.facebook.android:facebook-android-sdk:4.15.0@aar'
compile 'com.facebook.android:audience-network-sdk:4.15.0'
compile 'com.parse.bolts:bolts-applinks:1.4.0'
compile 'com.android.support:cardview-v7:25.0.0'
这个例外是什么?我该如何解决?
答案 0 :(得分:-1)
您是否尝试更改广告SDK的版本? 我遇到了类似的问题,然后将广告SDK更改为
postcard<- c('loveletter#234', 'loveletter#234', 'loveletter#234', 'officialletter#22','officialletter#22','officialletter#22','officialletter#22', 'newyearletter#24','newyearletter#24','newyearletter#24')
person<- c('Jane', 'Katie', 'Vince', 'John','Jane', 'Katie','Oliver','Katie','Becca','John')
df<- data.frame(postcard,person)
试一试:)