0

What is the recommended version of the expo to integrate react-native-google-mobile-ads?

I have tried integrating the react-native-google-mobile-ads with Expo v48. But unfortunately, I got an error.

**Error:** "Invariant Violation: requireNativeComponent: 'RNGoogleMobileAdsBannerView' was not found in the UIManager".
# app.json

{
    "expo": {
    ...
    },
    "react-native-google-mobile-ads": {
      "android_app_id": "ca-app-pub-xxxxxxxx~xxxxxxxx"
    }
  }
  
Devendra
  • 117
  • 2
  • 12

1 Answers1

0

make sure you follow the setup properly, add admob id on app.json config

// <project-root>/app.json
{
  "expo": {
    // ...
  },
  "react-native-google-mobile-ads": {
    "android_app_id": "ca-app-pub-xxxxxxxx~xxxxxxxx",
    "ios_app_id": "ca-app-pub-xxxxxxxx~xxxxxxxx"
  }
}

Source: https://docs.page/invertase/react-native-google-mobile-ads

bagi2info.com
  • 408
  • 1
  • 3
  • 11
  • Yes, I follow the setup as they have mentioned in the documentation. – Devendra Jun 04 '23 at 06:10
  • did you recreate build development apk and include the library? this error is show that it can't find the library because using old apk without the library. On Dev client, the troublesome part is that you need to recreate the apk after adding new library that require dev-client, but no need if library supported directly from expo – bagi2info.com Jun 04 '23 at 06:21
  • Yes, I recreate the build development APK. When I install the APK and try to open it on Expo Go. The app is not getting open don't know what the issue is. – Devendra Jun 04 '23 at 06:32
  • no, don't use expo go, use the app installed, for the command use expo start --dev-client – bagi2info.com Jun 04 '23 at 06:34
  • I download the app, and for the command I use `expo start --dev-client`. When I open the app I got this message `App keeps stopping`. – Devendra Jun 04 '23 at 06:46
  • please share your app.json and your code for the ads – bagi2info.com Jun 04 '23 at 06:49
  • I'm using this library on all my apps, no issue at all – bagi2info.com Jun 04 '23 at 06:51
  • Is it necessary to use a real App ID from AdMob? Currently, I'm using a dummy ID the same as mentioned in the documentation. – Devendra Jun 05 '23 at 02:29
  • 1
    For config on app.json, yes, real app id, for testing use testing unit id like banner interstitial, change it if prod env to real – bagi2info.com Jun 05 '23 at 04:07