AdMob激励视频广告无法展示真实广告问题求助
AdMob激励视频真实广告无法展示,插屏/测试广告正常的问题排查
Hey folks, I'm currently integrating AdMob rewarded video ads into my app. Test ads work perfectly and show up on time, but when I switch to the real ad unit ID, the rewarded videos won't load at all. Oddly enough, interstitial ads and banner ads are working just fine with their real IDs. Below is my code, Logcat logs, and layout file—hoping someone can spot what's going wrong here!
My Code
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); MobileAds.initialize(this, "ad unit ID"); prepareAd(); mRewardedVideoAd = MobileAds.getRewardedVideoAdInstance(this); mRewardedVideoAd.setRewardedVideoAdListener(this); loadRewardedVideoAd(); adView = (AdView) findViewById(R.id.adView); AdRequest adRequest = new AdRequest.Builder().build(); adView.loadAd(adRequest); } public void prepareAd() { mInterstitialAd = new InterstitialAd(this); mInterstitialAd.setAdUnitId("ad unit ID"); mInterstitialAd.loadAd(new AdRequest.Builder().build()); } @Override protected void onStart() { super.onStart(); isVisible = true; if (scheduler == null) { scheduler = Executors.newSingleThreadScheduledExecutor(); scheduler.scheduleAtFixedRate(new Runnable() { public void run() { Log.i("hello", "world"); runOnUiThread(new Runnable() { public void run() { if (mRewardedVideoAd.isLoaded() && isVisible) { mRewardedVideoAd.show(); } else { Log.d("TAG", " Interstitial not loaded"); displayInterstitial(); } prepareAd(); } }); } }, 42, 42, TimeUnit.SECONDS); } } private void loadRewardedVideoAd() { if (!mRewardedVideoAd.isLoaded()) { mRewardedVideoAd.loadAd("ad unit ID", new AdRequest.Builder().build()); } }
Logcat Logs
01-28 17:41:32.357 7200-30384/com.deb.srikishnerastottorosotonam I/hello: world 01-28 17:41:32.357 7200-7200/com.deb.srikishnerastottorosotonam D/TAG: Interstitial not loaded 01-28 17:41:32.384 7200-7200/com.deb.srikishnerastottorosotonam D/DynamitePackage: Instantiating com.google.android.gms.ads.ChimeraAdManagerCreatorImpl 01-28 17:41:32.413 7200-7200/com.deb.srikishnerastottorosotonam I/Ads: Starting ad request. 01-28 17:41:32.414 7200-7200/com.deb.srikishnerastottorosotonam I/Ads: Use AdRequest.Builder.addTestDevice("8D2245D8347B7CF7C7C2C4B37E12F275") to get test ads on this device. 01-28 17:41:33.225 7200-7200/com.deb.srikishnerastottorosotonam D/cr_Ime: [InputMethodManagerWrapper.java:30] Constructor 01-28 17:41:33.229 7200-7200/com.deb.srikishnerastottorosotonam W/cr_AwContents: onDetachedFromWindow called when already detached. Ignoring 01-28 17:41:33.230 7200-7200/com.deb.srikishnerastottorosotonam D/cr_Ime: [InputMethodManagerWrapper.java:59] isActive: false 01-28 17:41:33.270 7200-7200/com.deb.srikishnerastottorosotonam I/cr_Ime: ImeThread is not enabled. 01-28 17:41:33.305 7200-7200/com.deb.srikishnerastottorosotonam W/cr_BindingManager: Cannot call determinedVisibility() - never saw a connection for the pid: 7200 01-28 17:41:33.305 7200-7200/com.deb.srikishnerastottorosotonam D/cr_Ime: [InputMethodManagerWrapper.java:59] isActive: false 01-28 17:41:33.653 7200-7200/com.deb.srikishnerastottorosotonam I/Ads: Ad finished loading. 01-28 17:41:34.938 7200-7200/com.deb.srikishnerastottorosotonam I/Ads: Ad is not visible. Not refreshing ad. 01-28 17:41:34.938 7200-7200/com.deb.srikishnerastottorosotonam I/Ads: Scheduling ad refresh 60000 milliseconds from now.
Layout File
<RelativeLayout> <Button android:id="@+id/button" android:text="Button" android:textSize="20dp" android:layout_centerInParent="true" android:layout_width="250dp" android:layout_height="wrap_content" /> <Button android:id="@+id/button2" android:text="Button2" android:textSize="20dp" android:layout_below="@+id/button" android:layout_centerInParent="true" android:layout_width="250dp" android:layout_height="wrap_content" /> <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" android:layout_alignParentTop="true" android:background="?attr/colorPrimary" android:minHeight="?attr/actionBarSize" android:theme="@style/ThemeOverlay.AppCompat.Dark" /> <com.google.android.gms.ads.AdView xmlns:ads="http://schemas.android.com/apk/res-auto" android:id="@+id/adView" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_alignParentBottom="true" ads:adSize="SMART_BANNER" ads:adUnitId="Banner Ad ID"> </com.google.android.gms.ads.AdView> </RelativeLayout>
Troubleshooting & Fixes
Let's break down the possible issues and how to fix them:
Ad Unit ID Validation
- First, double-check that your rewarded video ad unit ID is specifically created for rewarded videos in the AdMob dashboard. It's easy to accidentally copy an interstitial or banner ID by mistake, which will cause loads to fail.
- New ad units can take a few hours to get approved and start serving ads. If you just created the unit, wait a bit and try again later.
Missing Retry Logic for Rewarded Video
- Looking at your code, you only call
loadRewardedVideoAd()once inonCreate. If the initial load fails (due to no inventory, network issues, etc.), there's no code to retry loading. Unlike your interstitial ads, which get reloaded every 42 seconds viaprepareAd(), the rewarded video is left hanging. - Fix this by adding retry logic in the
onRewardedVideoAdFailedToLoadcallback:@Override public void onRewardedVideoAdFailedToLoad(int errorCode) { // Delay retry to avoid spamming AdMob servers new Handler(Looper.getMainLooper()).postDelayed(this::loadRewardedVideoAd, 5000); } - Also, make sure you're implementing all required
RewardedVideoAdListenermethods to track load status properly.
- Looking at your code, you only call
Visibility State Management
- Your Logcat shows
Ad is not visible. Not refreshing ad.—this suggests the ad tried to refresh when the app wasn't in the foreground. While you setisVisible = trueinonStart(), you should also setisVisible = falseinonStop()to prevent attempts to show ads when the app is backgrounded:@Override protected void onStop() { super.onStop(); isVisible = false; // Also pause the rewarded video ad to avoid memory leaks if (mRewardedVideoAd != null) { mRewardedVideoAd.pause(this); } } @Override protected void onResume() { super.onResume(); isVisible = true; if (mRewardedVideoAd != null) { mRewardedVideoAd.resume(this); } }
- Your Logcat shows
Ad Inventory & Account Status
- Sometimes real rewarded video ads don't load because AdMob has no inventory for your region, app category, or device. Try testing on a different network (like a VPN to a region with higher inventory) or wait a few days—new AdMob accounts often take time to build up ad fill rates.
- Also, ensure your AdMob account is in good standing (no policy violations) and that your app is properly linked to the AdMob project.
Give these fixes a try, and let me know if the rewarded videos start loading!
内容的提问来源于stack exchange,提问作者Deb Prakash Chatterjee
相关产品推荐
相关产品推荐

