Android admob 插页式广告未展示

Android admob interstitial ads don't show

清单许可

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

 import com.google.android.gms.ads.AdListener;
 import com.google.android.gms.ads.AdRequest;
 import com.google.android.gms.ads.InterstitialAd;   


...
...
InterstitialAd mInterstitialAd;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mInterstitialAd = new InterstitialAd(this);
    mInterstitialAd.setAdUnitId("ca-app-pub-264***********");        

    AdRequest adRequest = new AdRequest.Builder()
     .addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
            .build();

    mInterstitialAd.loadAd(adRequest);

    // Prepare an Interstitial Ad Listener
    mInterstitialAd.setAdListener(new AdListener() {
        public void onAdLoaded() {
            // Call displayInterstitial() function
            displayInterstitial();
        }
    });
    ...
    ...
    ...

public void displayInterstitial() {
    // If Ads are loaded, show Interstitial else show nothing.
    if (mInterstitialAd.isLoaded()) {
        mInterstitialAd.show();
    }
}

大家好 E/dalvikvm(27771): 找不到 class 'android.app.AppOpsManager',从方法 com.google.android.gms.common.GooglePlayServicesUtil.zza

引用

E/dalvikvm(27771): 找不到 class 'android.app.AppOpsManager',从方法 com.google.android.gms.common.kf.a

引用

LogCat 显示这个错误.. 程序 运行 但它不显示广告。

要显示插页式广告,您需要在清单中添加额外的 "activity",例如:

<activity
        android:name="com.google.android.gms.ads.AdActivity"
        android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />

如果这不起作用,请尝试添加

android:multiprocess="true" //or maybe
android:process=":remote"


只是一个观察:在加载时显示广告并不总是一个好主意。作为 Google say here:

AdMob interstitials are full-page ads that appear in your app at natural breaks or transition points. A common use case is after a level is completed in a game.