加载 ap 并尝试请求广告时,收到此错误。
10-18 22:48:23.634: E/Ads(3776): JS: Uncaught ReferenceError: AFMA_getSdkConstants is not defined (http://media.admob.com/:1)
10-18 22:48:23.634: E/Web Console(3776): Uncaught ReferenceError: AFMA_getSdkConstants is not defined at http://media.admob.com/:1
我正在使用谷歌的代码,例如
public class Banner extends Activity {
private AdView adView;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
String admob_publisher_id = "pub-blahblahblah";
adView = new AdView(this, AdSize.BANNER, admob_publisher_id);
TableLayout layout = (TableLayout) findViewById(R.id.tableLayout1);
layout.addView(adView);
adView.loadAd(new AdRequest());
adView.isActivated();
adView.isEnabled();
}
@Override
public void onDestroy() {
if (adView != null) {
adView.destroy();
}
super.onDestroy();
}
}
我也尝试使用以下,但没有效果。
(new Thread() {
public void run() {
Looper.prepare();
adView.loadAd(new AdRequest());
}
}).start();
在我的主表格布局中,我还使用了谷歌示例中的代码。它在布局上显示 adview。
那么,我该如何解决这种问题呢?