AdMob 奖励广告在我的 Android 模拟器上崩溃

问题描述

我的主要活动:

    //init ads & load
    MobileAds.initialize(getApplicationContext(),new OnInitializationCompleteListener() {
        @Override
        public void onInitializationComplete(InitializationStatus initializationStatus) {
            //on initalized
        }
    });

loadRewardedAd()

    private void loadRewardedAd() {
    RewardedAd.load(getApplicationContext(),ADS_REWARDED_ID,new AdRequest.Builder().build(),new RewardedAdLoadCallback() {
        @Override
        public void onAdLoaded(@NonNull RewardedAd rewardedAd) {
            super.onAdLoaded(rewardedAd);

            //loaded
            adsRewarded = rewardedAd;

            //listener
            adsRewarded.setFullScreenContentCallback(new FullScreenContentCallback() {
                @Override
                public void onAdFailedToShowFullScreenContent(AdError adError) {
                    super.onAdFailedToShowFullScreenContent(adError);

                    //Failed
                    adsRewarded = null;
                    loadRewardedAd();
                }

                @Override
                public void onAdShowedFullScreenContent() {
                    super.onAdShowedFullScreenContent();

                    //showed
                    adsRewarded = null;
                    loadRewardedAd();
                }

                @Override
                public void onAddismissedFullScreenContent() {
                    super.onAddismissedFullScreenContent();

                    //dismissed
                }
            });
        }

        @Override
        public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) {
            super.onAdFailedToLoad(loadAdError);

            //Failed
            adsRewarded = null;
        }
    });
}

有时当 onAdLoaded() 运行时,它会立即崩溃。但这仅发生在我的 Android 模拟器上。虽然我的手机是 Android 10(与模拟器相同),但我没有看到任何崩溃。我没有收到任何警告,logcat 只是发出内存泄漏警告。

崩溃日志:

https://paste.ubuntu.com/p/5WPZhkTknp/

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)