我在我的项目中使用firebase适配器,现在我正在整合admob以获得奖励广告,它工作正常,但是完成后的每个视频都会抛出以下错误......
java.lang.ClassCastException: com.google.ads.mediation.admob.AdMobAdapter cannot be cast to com.google.android.gms.ads.mediation.m
at com.google.android.gms.ads.internal.mediation.client.y.a(:com.google.android.gms.dynamite_dynamitemodulesa@12685008@12.6.85 (020306-197041431):262)
at com.google.android.gms.ads.internal.reward.c.b(:com.google.android.gms.dynamite_dynamitemodulesa@12685008@12.6.85 (020306-197041431):54)
at com.google.android.gms.ads.internal.reward.client.e.onTransact(:com.google.android.gms.dynamite_dynamitemodulesa@12685008@12.6.85 (020306-197041431):56)
at android.os.Binder.transact(Binder.java:380)
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.mopub.mobileads.GooglePlayServicesRewardedVideo$1.onResume(GooglePlayServicesRewardedVideo.java:84)
at com.mopub.common.MoPubLifecycleManager.onResume(MoPubLifecycleManager.java:83)
at com.mopub.common.MoPub.onResume(MoPub.java:257)
at com.coderays.realquiz.RealQuizDashBoard.onResume(RealQuizDashBoard.java:956)
at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1280)
at android.app.Activity.performResume(Activity.java:6096)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3011)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3063)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1361)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5343)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700)
我将尝试使用此方法https://stackoverflow.com/a/49959522/6477998,但仍会抛出此错误。
我的朋友是..
dependencies {
implementation('com.mopub:mopub-sdk-interstitial:5.0.0@aar') {
transitive = true
}
// For rewarded videos. This will automatically also include interstitials
implementation('com.mopub:mopub-sdk-rewardedvideo:5.0.0@aar') {
transitive = true
}
implementation 'com.google.firebase:firebase-core:16.0.0'
implementation 'com.google.firebase:firebase-ads:15.0.1'
}
要改变哪一个,请给我一个解决方案,我仍在搜索3天但没有改进。
推进thanx ......
答案 0 :(得分:0)
谢谢,该错误将在较长时间后得到解决。
步骤1:我从mac = BitConverter.ToString(MacAddr);
删除了我的适配器类GooglePlayServicesRewardedVideo.java
(如果您使用的是com.mopub.mobileads
,请删除)。
第2步:,然后将admob中介sdk放入build.gradle中,即GooglePlayServicesInterstitial.java
。
第3步:,然后,在有奖励的展示活动中删除以下几行。
implementation 'com.mopub.mediation:admob:15.0.0.8'
步骤4:同步您的项目,并进行构建。它工作正常,没有错误。
谢谢。