I try create admob banner in my app and I get error code 3 please help me to get solution.
I have meta-data in manifest
layout:
<com.google.android.gms.ads.AdView
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="@+id/adView111"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
ads:adSize="SMART_BANNER"
ads:adUnitId="ca-app-pub-9038559490997069/7964491403">
</com.google.android.gms.ads.AdView>
</LinearLayout>
Java:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home);
MobileAds.initialize(this, new OnInitializationCompleteListener() {
@Override
public void onInitializationComplete(InitializationStatus initializationStatus) {
}
});
AdView adView = new AdView(this);
adView.setAdSize(AdSize.BANNER);
adView.setAdUnitId("ca-app-pub-9038559490997069/7964491403");
adView = findViewById(R.id.adView111);
AdRequest adRequest = new AdRequest.Builder().build();
adView.setAdListener(new com.google.android.gms.ads.AdListener() {
@Override
public void onAdLoaded() {
super.onAdLoaded();
Log.e("onAdLoaded","AdLoaded");
}
@Override
public void onAdFailedToLoad(int errorCode) {
super.onAdFailedToLoad(errorCode);
Log.e("onAdFailedToLoad",""+errorCode);
}
});
adView.loadAd(adRequest);
}
I know have error 3 if admob account is new, I create my admob account before one week.
i get some Logs:
W/FA-Ads: Disabling data collection. Found google_app_id in strings.xml but Google Analytics for Firebase is missing. Remove this value or add Google Analytics for Firebase to resume data collection.2019-12-13 12:06:50.041 6768-6768/myapplication.game D/DynamitePackage: Instantiating com.google.android.gms.ads.ChimeraMobileAdsSettingManagerCreatorImpl
I/Ads: Updating ad debug logging enablement.
D/DynamitePackage: Instantiating com.google.android.gms.ads.ChimeraAdManagerCreatorImpl
I/Ads: Use AdRequest.Builder.addTestDevice("94DF0193F80DB5F14BFF0EA958D02BC9") to get test ads on this device.
2019-12-13 12:06:50.248 6768-6768/myapplication.game I/DynamiteModule: Considering local module com.google.android.gms.ads.dynamite:0 and remote module com.google.android.gms.ads.dynamite:21001
I/DynamiteModule: Selected remote version of com.google.android.gms.ads.dynamite, version >= 21001
W/Ads: Update ad debug logging enablement as false
W/Ads: Not retrying to fetch app settings
I/Ads: Ad failed to load : 3