Do I use right package for showing Admob ad in React Native Expo?

561 views
Skip to first unread message

Darius Design

unread,
Mar 20, 2024, 8:36:33 AM3/20/24
to Google Mobile Ads SDK Developers
I have used React Native Expo for app development, npm i react-native-google-mobile-ads package, this documentation, only one page project with code:
import React from 'react';
import { BannerAd, BannerAdSize, TestIds } from 'react-native-google-mobile-ads';

const adUnitId = __DEV__ ? TestIds.ADAPTIVE_BANNER : 'ca-app-pub-xxxxxxxxxxxxx/yyyyyyyyyyyyyy';

function App() {
  return (
    <BannerAd
      unitId={adUnitId}
      size={BannerAdSize.ANCHORED_ADAPTIVE_BANNER}
    />
  );
}
And got an error:
Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'RNGoogleMobileAdsModule' could not be found. Verify that a module by this name is registered in the native binary.Bridgeless mode: false. TurboModule interop: false. Modules loaded: {"NativeModules":["PlatformConstants","LogBox","SourceCode","Timing","AppState","BlobModule","WebSocketModule","DevSettings","DevToolsSettingsManager","Networking","Appearance","DevLoadingView","HeadlessJsTaskSupport","DeviceInfo","UIManager","DeviceEventManager"],"TurboModules":[],"NotFound":["NativePerformanceCxx","NativePerformanceObserverCxx","RedBox","BugReporting","RNGoogleMobileAdsModule"]}, js engine: hermes
 ERROR Invariant Violation: "main" has not been registered. This can happen if:
* Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
* A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called., js engine: hermes
Where is a problem and how to get finally that ad to show on my app's screen?

Mobile Ads SDK Forum Advisor

unread,
Mar 20, 2024, 1:06:17 PM3/20/24
to darius...@gmail.com, google-adm...@googlegroups.com

Hi,

Thank you for contacting the Mobile Ads SDK Support team.

I see that same concern on another thread with the subject '[google-admob-ads-sdk] I develop mobile app and I want to use AdMob', and we have already responded there for this issue. To avoid multiple threads on the same issue, please take a look at that thread and continue the discussion on the same for further updates on the issue.

Please reach out to us, if you need any further assistance. 

This message is in relation to case "ref:!00D1U01174p.!5004Q02s05mJ:ref" (ADR-00228019)

Thanks,
 
Google Logo Mobile Ads SDK Team

 

Reply all
Reply to author
Forward
0 new messages