Search code examples
react-nativeexpoadmob

Getting error when using react-native-google-mobile-ads in expo project


When I try to run the project on expo go, I get the following error and the projects refuses to run.

Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'RNGoogleMobileAdsModule' could not be found. Verify that a module by this name is registered in the native binary.

Solution

  • I finally figured out that my package.json was not set up correctly. The react-native-google-mobile-ads was inside the expo section. It should be as follows:

    {
      "expo": {
      },
      "react-native-google-mobile-ads": {
        "android_app_id": "ca-app-pub-xxxxxxxx~xxxxxxxx",
        "ios_app_id": "ca-app-pub-xxxxxxxx~xxxxxxxx"
      }
    }