gpt4 book ai didi

android - 如何解决此错误 'com.google.ads.mediation.admob.AdMobAdapter cannot be cast to com.google.android.gms.ads.mediation.m '?

转载 作者:太空宇宙 更新时间:2023-11-03 10:58:37 27 4
gpt4 key购买 nike

我在我的项目中使用 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但仍然抛出这个错误。

我的gradle是..

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天了,没改善。

提前比...

最佳答案

谢谢,这个错误会在很长时间后修复。

第 1 步: 我从 com.mopub.mobileads 中删除我的适配器类 GooglePlayServicesRewardedVideo.java(如果您使用的是 GooglePlayServicesInterstitial .java 请删除 ).

第 2 步: 然后,将 admob 中介 sdk 放入 build.gradle 即 implementation 'com.mopub.mediation:admob:15.0.0.8'

第 3 步:然后,删除奖励展示 Activity 中的以下行。

public class MainActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
MoPubRewardedVideos.initializeRewardedVideo(this);
MoPub.onCreate(this); // remove
// ...
}

@Override
public void onPause() {
super.onPause();
MoPub.onPause(this); // remove
}

@Override
public void onResume() {
super.onResume();
MoPub.onResume(this); // remove
}

// The following methods are required for Chartboost rewarded video mediation
@Override
public void onStart() {
super.onStart();
MoPub.onStart(this); // remove
}

@Override
public void onRestart() {
super.onRestart();
MoPub.onRestart(this); // remove
}

@Override
public void onStop() {
super.onStop();
MoPub.onStop(this); // remove
}

@Override
public void onDestroy() {
super.onDestroy();
MoPub.onDestroy(this); // remove
}

@Override
public void onBackPressed() {
super.onBackPressed();
MoPub.onBackPressed(this); // remove
}
}

第 4 步: 同步您的项目,并进行构建。它工作正常,没有错误。

谢谢。

关于android - 如何解决此错误 'com.google.ads.mediation.admob.AdMobAdapter cannot be cast to com.google.android.gms.ads.mediation.m '?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50885230/

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