我正在尝试在我的应用程序中实现AdMob,但出现错误了 我的错误是:
I/Ads: This request is sent from a test device.
I/Ads: Ad failed to load: 2
Java代码:
MobileAds.initialize(this,"ca-app-pub-3940256099942544~3347511713");
AdView adView=(AdView)findViewById(R.id.adv_id);
AdRequest adRequest = new AdRequest.Builder().addTestDevice(
AdRequest.DEVICE_ID_EMULATOR).build();
adView.loadAd(adRequest);
XML
ads:adUnitId="ca-app-pub-3940256099942544~3347511713"></com.google.android.gms.ads.AdView>
答案 0 :(得分:0)
请检查并确认以下内容。
1。。您是否将AdMob ID添加到清单文件中?
var count = 0;
var lineReader = require('readline').createInterface({
input: require('fs').createReadStream('./data.js')
});
lineReader.on('line', function (line) {
++count; // keep a count of number of lines
if (line.length > 0) {
console.log('Line from file:', line);
}
});
2。。是否添加了.addTestDevice(“ .....”)?
<manifest>
<application>
<!-- Sample AdMob App ID: ca-app-pub-3940256099942544~3347511713 -->
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="YOUR_ADMOB_APP_ID"/>
</application>
3。。您是否可以连接互联网?