Reputation: 63
I am trying to show a smart size banner in android, but the ad isn't showing and when I see the logs it says: I/Ads: Ad failed to load : 2
.
I searched on the internet and found that issue is due to internet connection, but I have active and reliable net connection on my phone.
Below is my app
gradle:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:2.0.0-alpha3'
implementation 'com.android.support:support-v4:28.0.0'
testCompile 'junit:junit:4.12'
implementation 'com.airbnb.android:lottie:2.1.0'
implementation 'com.mikhaellopez:circularimageview:3.2.0'
implementation 'com.google.android.gms:play-services-ads:17.1.2'
}
and below is my activity class:
MobileAds.initialize(this, Utils.ADMOB_APP_ID);
mAdView = findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().addTestDevice("B2DD8C77E01892E0FF2A672FC77E2FF9").build();
mAdView.loadAd(adRequest);
and this is the layout:
<com.google.android.gms.ads.AdView
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="@+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
ads:adSize="SMART_BANNER"
ads:adUnitId="@string/app_admob_id">
</com.google.android.gms.ads.AdView>
and this is the some of error log related to the ads:
W/Ads: Invoke Firebase method getInstance error.
The Google Mobile Ads SDK will not integrate with Firebase. Admob/Firebase integration requires the latest Firebase SDK jar, but Firebase SDK is either missing or out of date
W/Ads: Not retrying to fetch app settings
I/Ads: Ad failed to load : 2
Upvotes: 0
Views: 6183
Reputation: 406
Some times your internet may be blocked by google adds due to multiple request within few minutes.
Upvotes: 0
Reputation: 1649
This problem most often occurs when there is no Internet connection.
Upvotes: 1