Reputation: 519
The interstitial ads working in all devices, but the banner not showing in android pie on devices like Samsung S8, The banner working fine on other devices with lower api, admob activated two years ago it is working fine i noticed this problem by accident.
All my app have same problem, Banner working on lower "android Pie" perfectly
I am using latest api
implementation 'com.google.firebase:firebase-ads:17.1.2'
Also added meta-data in manifest
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-xxxxxxxxxx~xxxxxxxxxxxx"/>
<activity
THIS IS MY CODE
MobileAds.initialize(getApplicationContext(), "ca-app-pub-XXXXXXXXXXXX~XXXXXXXXXX");
AdView mAdView = findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
mAdView.loadAd(adRequest);
Layout code
<com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="false"
android:layout_alignParentStart="false"
app:adSize="SMART_BANNER"
app:adUnitId="@string/banner_ad_unit_id">
Also there is no margin or padding in layout That holding Adview, banner working on Samsung s4 Huaweie etc using same code above
*** Update
I have another app didnt update long time ago using
classpath 'com.google.gms:google-services:3.1.1'
and api
compile 'com.google.firebase:firebase-ads:11.8.0'
and
compileSdkVersion 27
Admob banner working fine on Samsung s8 , any suggestions ? i think this is common problem...
Upvotes: 1
Views: 923
Reputation: 1742
@dreamer
I'm able to get admob banners in Android 9 phones after adding the following line inside android/app/build.gradle, dependecies:
implementation 'com.google.android.gms:play-services-ads:17.2.0'
pls. check if this can also fix your problem.
Update: another place I forgot to mention, i.e. the android/app/src/main/AndroidManifest.xml:
<application
tools:replace="android:label"
android:name="io.flutter.app.FlutterApplication"
android:label="NameOfYourApp"
android:usesCleartextTraffic="true"
android:icon="@mipmap/ic_launcher">
<uses-library android:name=org.apache.http.legacy android:required=false/>
i.e. add 2 lines:
(1) Inside <application>
android:usesCleartextTraffic="true"
(2) Right after <application>
, but before </application>
<uses-library android:name=org.apache.http.legacy android:required=false/>
Upvotes: 1