0

行 adView.setTesting(true); 给 ea 错误说方法不退出,代码 blocksetTesting adView = new AdView(this, AdSize.BANNER, "a14e10cb6b18825"); ad = new AdView(this, AdSize.BANNER, "a14e10cb6b18825");

    // Lookup your LinearLayout assuming it’s been given
    // the attribute android:id="@+id/mainLayout"
    LinearLayout layout = (LinearLayout)findViewById(R.id.mainLayout);

    // Add the adView to it
    layout.addView(adView);

    // Initiate a generic request to load it with an ad
    adView.setTesting(true);

    adView.loadAd(new AdRequest());
4

1 回答 1

1

我对setTesting()api调用不熟悉。在我的 AdMob 代码中,我使用

AdRequest adRequest = new AdRequest();
adRequest.addTestDevice(MY_TEST_DEVICE_ID);
adView.loadAd(adRequest);

当我运行代码并且我没有指定测试设备时,我通常会在LOGCAT告诉我使用addTestDeviceapi添加我的设备 ID 时看到一条日志消息

于 2012-06-01T01:28:26.730 回答