I have the same code working on a whole new project, which can load the AdMob banner successfully with TestID or my Gad ID.
However, for a project that I was trying to move to Jetpack Compose, the same codes failed, with Test ID, "Ad failed to load : 3", with my Gad ID, "Ad failed to load : 1"
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-9528408865218303~2434754358"/>
.....
AndroidView(
factory = { context ->
AdView(context).apply{
setAdSize(AdSize.getCurrentOrientationAnchoredAdaptiveBannerAdSize(context,deviceCurrentWidth),)
adUnitId = unitId
}
},
it seems the codes works (at least for a whole new project), but there is some config/state incorrect in my old projects.
thanks
2
Answers
This is very common, The source of the problem can be one of the following :
1. This may happen particularly if you have just registered your AdMob publisher ID, as it takes some time and multiple requests before the new ID starts returning ads.
2. You have not enabled the
Contains Ads
,in the play console (in Pricing & distribution section)3. You haven’t published a version of the app with ads yet.
4. You are using a test device. (Always use test ad ids provided by admob, for test purposes)
5. Your network connection has a problem. You do not have to use proxy
When you first design your application, you can use the Firebase assistance of Android Studio, to link your app with firebase and adMobe.
Why don’t you check with test AdUnit
/6499/example/banner
This should work for banner ads.
Happy coding!!