4

I have the next error:

ERROR Invariant Violation: requireNativeComponent: "RNGoogleMobileAdsBannerView" was not found..

This error is located at:

in RNGoogleMobileAdsBannerView (created by BaseAd)
in BaseAd (created by BannerAd)
in BannerAd (created by BannerAd)
in BannerAd (created by HomeMenu)

...

In my package.json I have the necessary modules

 "expo": "^48.0.0",
 "expo-build-properties": "~0.5.1",
 "react-native-google-mobile-ads": "^10.0.0",

And when I want to add banner :

 BannerAd(props) {
    
    const adUnitID = Platform.select({
      ios: Environment.ADS[Platform.OS].BANNER || TestIds.BANNER,
      android: Environment.ADS[Platform.OS].BANNER || TestIds.BANNER,
    });

    return (
      <BannerAd
        unitId={adUnitID}
        size={BannerAdSize.BANNER}
        requestOptions={{
          requestNonPersonalizedAdsOnly: true,
        }}
        onAdFailedToLoad={() => <View></View>}
        {...props}
      />
    );
  }

I dont know what is happening.

I have reinstalled the modules I have also change sdk expo but I dont fix it.

bagi2info.com
  • 408
  • 1
  • 3
  • 11

1 Answers1

0
  1. first you need to create apk for development
eas build -p android --profile development
  1. install the app on your simulator or device

  2. start the app by run the command and open the app directly not Expo Go App

expo start --dev-client

Note: Adding any library that require expo-dev-client need to recreate the apk dev

Reference: https://docs.expo.dev/build/setup/

bagi2info.com
  • 408
  • 1
  • 3
  • 11