Java.lang.verifyerror 使用 admob 奖励广告时
Java.lang.verifyerror when using admob rewarded ads
每当我打开我的应用程序时,它就会崩溃并显示以下错误
Error image
我注意到当我使用 admob 奖励广告代码时会发生这种情况,请任何人提供帮助。谢谢
尝试使用更新的 admob sdk。
implementation 'com.google.android.gms:play-services-ads:20.1.0'
//class will implements OnUserEarnedRewardListener
private RewardedInterstitialAd rewardedInterstitialAd;
@Override
public void onUserEarnedReward(@NonNull RewardItem rewardItem) {
Log.i(TAG, "onUserEarnedReward");
// TODO: Reward the user!
}
public void loadRewardedAd() {
// Use the test ad unit ID to load an ad.
RewardedInterstitialAd.load(MainActivity.this, getString(R.string.rewarded_interstitial_id),
new AdRequest.Builder().build(), new RewardedInterstitialAdLoadCallback() {
@Override
public void onAdLoaded(RewardedInterstitialAd ad) {
rewardedInterstitialAd = ad;
rewardedInterstitialAd.setFullScreenContentCallback(new FullScreenContentCallback() {
/** Called when the ad failed to show full screen content. */
@Override
public void onAdFailedToShowFullScreenContent(AdError adError) {
Log.i(TAG, "onAdFailedToShowFullScreenContent");
}
/** Called when ad showed the full screen content. */
@Override
public void onAdShowedFullScreenContent() {
Log.i(TAG, "onAdShowedFullScreenContent");
}
/** Called when full screen content is dismissed. */
@Override
public void onAdDismissedFullScreenContent() {
Log.i(TAG, "onAdDismissedFullScreenContent");
}
});
}
@Override
public void onAdFailedToLoad(LoadAdError loadAdError) {
Log.e(TAG, "onAdFailedToLoad");
}
});
}
每当我打开我的应用程序时,它就会崩溃并显示以下错误 Error image
我注意到当我使用 admob 奖励广告代码时会发生这种情况,请任何人提供帮助。谢谢
尝试使用更新的 admob sdk。
implementation 'com.google.android.gms:play-services-ads:20.1.0'
//class will implements OnUserEarnedRewardListener
private RewardedInterstitialAd rewardedInterstitialAd;
@Override
public void onUserEarnedReward(@NonNull RewardItem rewardItem) {
Log.i(TAG, "onUserEarnedReward");
// TODO: Reward the user!
}
public void loadRewardedAd() {
// Use the test ad unit ID to load an ad.
RewardedInterstitialAd.load(MainActivity.this, getString(R.string.rewarded_interstitial_id),
new AdRequest.Builder().build(), new RewardedInterstitialAdLoadCallback() {
@Override
public void onAdLoaded(RewardedInterstitialAd ad) {
rewardedInterstitialAd = ad;
rewardedInterstitialAd.setFullScreenContentCallback(new FullScreenContentCallback() {
/** Called when the ad failed to show full screen content. */
@Override
public void onAdFailedToShowFullScreenContent(AdError adError) {
Log.i(TAG, "onAdFailedToShowFullScreenContent");
}
/** Called when ad showed the full screen content. */
@Override
public void onAdShowedFullScreenContent() {
Log.i(TAG, "onAdShowedFullScreenContent");
}
/** Called when full screen content is dismissed. */
@Override
public void onAdDismissedFullScreenContent() {
Log.i(TAG, "onAdDismissedFullScreenContent");
}
});
}
@Override
public void onAdFailedToLoad(LoadAdError loadAdError) {
Log.e(TAG, "onAdFailedToLoad");
}
});
}