I am trying to implement AdMob in my Xamarin Form app. I am following AdMob In Xamarin Forms to implement AdMob ad. However, it seems the ad is not appearing. In the output I am getting following output which shows something is not working.
I added following two packages in my Android project.
02-29 23:23:58.145 W/mpanyname.dest( 5974): JNI RegisterNativeMethods: attempt to register 0 native methods for crc64b6d8dc29f1e2b389.AdMobViewRenderer 02-29 23:23:58.216 D/DynamitePackage( 5974): Instantiating com.google.android.gms.ads.ChimeraAdManagerCreatorImpl 02-29 23:23:58.232 I/Ads ( 5974): This request is sent from a test device. 02-29 23:23:58.294 I/mpanyname.dest( 5974): The ClassLoaderContext is a special shared library. 02-29 23:23:58.366 I/DynamiteModule( 5974): Considering local module com.google.android.gms.ads.dynamite:0 and remote module com.google.android.gms.ads.dynamite:21200 02-29 23:23:58.366 I/DynamiteModule( 5974): Selected remote version of com.google.android.gms.ads.dynamite, version > 21200 02-29 23:23:58.545 I/mpanyname.dest( 5974): Background concurrent copying GC freed 8964(1124KB) AllocSpace objects, 7(356KB) LOS objects, 49% free, 3MB/7MB, paused 1.763ms total 203.190ms 02-29 23:23:58.765 E/FA ( 5974): GoogleService failed to initialize, status: 10, Missing google app id value from from string resources with name google_app_id.
I don’t know why it is not showing, but I guess according to the output there could be some error.
Output After removing Xamarin.Firebase.Ads because I only want Google play services ad.
03-03 14:27:45.967 D/DynamitePackage(16402): Instantiating com.google.android.gms.ads.ChimeraAdManagerCreatorImpl 03-03 14:27:45.985 I/Ads (16402): This request is sent from a test device. 03-03 14:27:46.227 I/DynamiteModule(16402): Considering local module com.google.android.gms.ads.dynamite:0 and remote module com.google.android.gms.ads.dynamite:21200 03-03 14:27:46.228 I/DynamiteModule(16402): Selected remote version of com.google.android.gms.ads.dynamite, version > 21200 03-03 14:27:46.263 I/mpanyname.dest(16402): The ClassLoaderContext is a special shared library. 03-03 14:27:46.354 W/Ads (16402): Invoke Firebase method getInstance error. 03-03 14:27:46.355 W/Ads (16402): 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 03-03 14:27:46.738 W/mpanyname.dest(16402): Accessing hidden field Ljava/nio/Buffer;->address:J (light greylist, reflection)
Solved my issue by these steps.
- Removed Xamarin.GooglePlayServices.Ad and Xamarin.Firebase.Ads packages
- Added the lite version of Xamarin.GooglePlayServices.Ads.Lite
- Added test Unit Id found in Admob Test Ads
- Added true for Application ID in Adnroid manifest instead of Application Id
Edit 5. You need to make sure that you have created your account in admob and it is approved. That means that you have to add your account details and bank information (not payment method) then you receive an approval email from admob that your ad can appear and they also send you a guide on how to incorporate your ads which exactly the steps mentioned in my answer.
Answered By – ARH