Admob 测试广告一天后没有显示
Admob testing ads not showing after a day that they did
您好,我是使用 admob 广告的新手,我遇到了一个奇怪的问题。我使用以下 link 添加了测试广告:http://www.androidhive.info/2016/02/android-how-to-integrate-google-admob-in-your-app/
昨晚的广告效果很好。我今晚打开了我的应用程序,但由于某种原因广告标签不见了,查看控制台时我收到以下错误:I/FirebaseInitProvider:FirebaseApp 初始化不成功
知道会发生什么吗?谢谢!
JAVA:
MobileAds.initialize(getApplicationContext(), "ca-app-pub-3940256099942544~3347511713");
AdView mAdView = (AdView) findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder()
.addTestDevice("ID from device added removed for post")
.build();
mAdView.loadAd(adRequest);
GRADLE:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.google.android.gms:play-services-ads:9.0.2'
compile 'com.google.firebase:firebase-ads:9.0.2'
}
XML:
<com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
ads:adSize="BANNER"
ads:adUnitId="@string/banner_ad_unit_id">
</com.google.android.gms.ads.AdView>
请查看以下流程,可能对您有所帮助
首先检查项目级别 gradel,你是否已经实现了如下 class 路径,classpath 'com.google.gms:google-services:3.0.0'
然后检查应用程序级别的依赖性,如下所示compile 'com.google.firebase:firebase-ads:9.0.2'
(根据最新库)
然后在底部应用插件,如下所示apply plugin: 'com.google.gms.google-services'
然后检查你设置的App Id或Unit Id是否正确。
然后检查您声明添加的布局,是否实现了以下命名空间xmlns:ads="http://schemas.android.com/apk/res-auto"
如果您使用的是 InterstitialAd,那么它需要像下面这样添加测试设备 ID,
AdRequest adRequest = 新 AdRequest.Builder()
.addTestDevice("SEE_YOUR_LOGCAT_TO_GET_YOUR_DEVICE_ID")
.build();
这一切可能对你有帮助,
您好,我是使用 admob 广告的新手,我遇到了一个奇怪的问题。我使用以下 link 添加了测试广告:http://www.androidhive.info/2016/02/android-how-to-integrate-google-admob-in-your-app/
昨晚的广告效果很好。我今晚打开了我的应用程序,但由于某种原因广告标签不见了,查看控制台时我收到以下错误:I/FirebaseInitProvider:FirebaseApp 初始化不成功
知道会发生什么吗?谢谢!
JAVA:
MobileAds.initialize(getApplicationContext(), "ca-app-pub-3940256099942544~3347511713");
AdView mAdView = (AdView) findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder()
.addTestDevice("ID from device added removed for post")
.build();
mAdView.loadAd(adRequest);
GRADLE:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.google.android.gms:play-services-ads:9.0.2'
compile 'com.google.firebase:firebase-ads:9.0.2'
}
XML:
<com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
ads:adSize="BANNER"
ads:adUnitId="@string/banner_ad_unit_id">
</com.google.android.gms.ads.AdView>
请查看以下流程,可能对您有所帮助
首先检查项目级别 gradel,你是否已经实现了如下 class 路径,
classpath 'com.google.gms:google-services:3.0.0'
然后检查应用程序级别的依赖性,如下所示
compile 'com.google.firebase:firebase-ads:9.0.2'
(根据最新库)然后在底部应用插件,如下所示
apply plugin: 'com.google.gms.google-services'
然后检查你设置的App Id或Unit Id是否正确。
然后检查您声明添加的布局,是否实现了以下命名空间
xmlns:ads="http://schemas.android.com/apk/res-auto"
如果您使用的是 InterstitialAd,那么它需要像下面这样添加测试设备 ID,
AdRequest adRequest = 新 AdRequest.Builder() .addTestDevice("SEE_YOUR_LOGCAT_TO_GET_YOUR_DEVICE_ID") .build();
这一切可能对你有帮助,