0

我已经根据https://developers.google.com/mobile-ads-sdk/docs/admob/advanced编写了将插页式广告从 admob 添加到我的应用程序菜单活动的代码。我也在 Manifest 中添加了 PERMISSIONS 和 configchanges。我在下面提到的行中遇到错误:

`

    interstitial = new InterstitialAd(this); // Error: The constructor InterstitialAd(MenuActivity) is undefined

    interstitial.setAdUnitId("lajdID"); // Error: The method setAdUnitId(String) is undefined for the type InterstitialAd

    // Create ad request.
    AdRequest adRequest = new AdRequest.Builder().build(); //AdRequest.Builder cannot be resolved to a type

    // Begin loading your interstitial.
    interstitial.loadAd(adRequest);

`

4

2 回答 2

0

该错误告诉您 MenuActivity 不是 android.app.Activity 的实例。

于 2014-04-06T05:15:48.380 回答
0

您应该从以下位置导入 admob;

import com.google.android.gms.ads.*;
于 2014-04-06T03:31:29.193 回答