我已经通过AdColony的中介实施了Admob的奖励视频广告。广告可以很好地加载,但是当我更改设备方向或退出应用并返回时,广告无法加载,错误代码3,这是没有填充错误。由于我使用的是测试广告,因此不会发生此错误。每次我重新安装该应用程序或从“最近浏览”屏幕中将其刷除后打开它时,广告都会加载。
我在日志输出中得到以下信息:
08-25 16:26:09.966 21229-21229/com.appsbyusman.stealthaudioplayer W/Ads: Failed
java.lang.ClassCastException: com.jirbo.adcolony.AdColonyAdapter cannot be cast to com.google.android.gms.ads.mediation.OnContextChangedListener
at com.google.android.gms.internal.ads.zzyk.zzi(Unknown Source)
at com.google.android.gms.internal.ads.zzxr.dispatchTransaction(Unknown Source)
at com.google.android.gms.internal.ads.zzek.onTransact(Unknown Source)
at android.os.Binder.transact(Binder.java:387)
at mt.b(:com.google.android.gms.dynamite_adsdynamite@[email protected] (040308-204998136):20)
at com.google.android.gms.ads.internal.mediation.client.g.a(:com.google.android.gms.dynamite_adsdynamite@[email protected] (040308-204998136):137)
at com.google.android.gms.ads.internal.reward.d.c(:com.google.android.gms.dynamite_adsdynamite@[email protected] (040308-204998136):71)
at com.google.android.gms.ads.internal.reward.client.g.a(:com.google.android.gms.dynamite_adsdynamite@[email protected] (040308-204998136):54)
at mu.onTransact(:com.google.android.gms.dynamite_adsdynamite@[email protected] (040308-204998136):12)
at android.os.Binder.transact(Binder.java:387)
at com.google.android.gms.internal.ads.zzej.transactAndReadExceptionReturnVoid(Unknown Source)
at com.google.android.gms.internal.ads.zzahb.zze(Unknown Source)
at com.google.android.gms.internal.ads.zzahm.resume(Unknown Source)
at com.appsbyusman.stealthaudioplayer.DrawerAndFragmentActivity.onResume(DrawerAndFragmentActivity.java:920)
at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1258)
at android.app.Activity.performResume(Activity.java:6327)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3092)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3134)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2481)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
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)
at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:102)
还有这个:
08-25 16:26:11.142 21229-21229/com.appsbyusman.stealthaudioplayer E/Ads: java.lang.NullPointerException: Attempt to invoke interface method 'void com.google.android.gms.ads.reward.mediation.MediationRewardedVideoAdListener.onAdLoaded(com.google.android.gms.ads.reward.mediation.MediationRewardedVideoAdAdapter)' on a null object reference
at com.jirbo.adcolony.AdColonyAdListener.notifyAdLoaded(AdColonyAdListener.java:164)
at com.jirbo.adcolony.AdColonyAdapter.loadAd(AdColonyAdapter.java:141)
at com.google.android.gms.internal.ads.zzyk.zza(Unknown Source)
at com.google.android.gms.internal.ads.zzyk.zzc(Unknown Source)
at com.google.android.gms.internal.ads.zzxr.dispatchTransaction(Unknown Source)
at com.google.android.gms.internal.ads.zzek.onTransact(Unknown Source)
at android.os.Binder.transact(Binder.java:387)
at mt.b(:com.google.android.gms.dynamite_adsdynamite@[email protected] (040308-204998136):20)
at com.google.android.gms.ads.internal.mediation.client.g.a(:com.google.android.gms.dynamite_adsdynamite@[email protected] (040308-204998136):70)
at com.google.android.gms.ads.internal.reward.mediation.a.a(:com.google.android.gms.dynamite_adsdynamite@[email protected] (040308-204998136):140)
at com.google.android.gms.ads.internal.reward.mediation.b.run(:com.google.android.gms.dynamite_adsdynamite@[email protected] (040308-204998136):3)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
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)
at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:102)
08-25 16:26:11.143 21229-21229/com.appsbyusman.stealthaudioplayer W/Ads: Fail to load ad from adapter.
android.os.RemoteException
at com.google.android.gms.internal.ads.zzyk.zza(Unknown Source)
at com.google.android.gms.internal.ads.zzyk.zzc(Unknown Source)
at com.google.android.gms.internal.ads.zzxr.dispatchTransaction(Unknown Source)
at com.google.android.gms.internal.ads.zzek.onTransact(Unknown Source)
at android.os.Binder.transact(Binder.java:387)
at mt.b(:com.google.android.gms.dynamite_adsdynamite@[email protected] (040308-204998136):20)
at com.google.android.gms.ads.internal.mediation.client.g.a(:com.google.android.gms.dynamite_adsdynamite@[email protected] (040308-204998136):70)
at com.google.android.gms.ads.internal.reward.mediation.a.a(:com.google.android.gms.dynamite_adsdynamite@[email protected] (040308-204998136):140)
at com.google.android.gms.ads.internal.reward.mediation.b.run(:com.google.android.gms.dynamite_adsdynamite@[email protected] (040308-204998136):3)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
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)
at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:102)
08-25 16:26:11.166 21229-21229/com.appsbyusman.stealthaudioplayer W/Ads: Failed to load ad: 3
上面的堆栈跟踪中提到的行是这样的:
@Override
public void onResume() {
mRewardedVideoAd.resume(DrawerAndFragmentActivity.this);
super.onResume();
}
我该怎么办才能解决这个问题?
最佳答案
请尝试更新到最新的AdColony SDK v3.3.5。 (https://github.com/AdColony/AdColony-Android-SDK-3)如果您使用的是AdMob中介,请使用最新的AdMob AdColony适配器v3.3.5.1。 (https://bintray.com/google/mobile-ads-adapters-android/com.google.ads.mediation.adcolony/3.3.5.1)另外,我建议使用
您build.gradle中的“ com.google.android.gms:play-services-ads:15.0.1”。