广告加载时出错

时间:2013-10-18 20:02:27

标签: android android-layout ads

当加载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 

我正在使用google的代码

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();

在我的主表格布局中,我也使用谷歌示例中的代码。它在布局上展示了广告。

那么,我该如何解决这类问题?

0 个答案:

没有答案