简体   繁体   中英

React native google admob error?

good morning everyone,

steps i took:

npm install --save react-native-admob@next, npm install

then i went on implementing admob in my app, bear in mind i am using expo SDK,

the code look like this:

import {AdMobBanner} from 'react-native-admob';
....
render(){
return(
<AdMobBanner
              adSize="fullBanner"
              adUnitID="ca-app-pub-123456789/12321312"
              testDevices={[AdMobBanner.simulatorId]}
              onAdFailedToLoad={error => console.error(error)}
            />
)
}

the error is :

invariant violation native component for RNGADBannerView does not exist

i did pull an all nighter, and still couldn't figure it out! please can anyone help.

Go To

/node_modules/react-native-admob/android/src/main/java/com/sbugert/rnadmob/RNAdMobRewardedVideoAdModule.java

 @Override
 public void onRewardedVideoCompleted() {
    sendEvent(EVENT_VIDEO_COMPLETED, null);
  }

Delete @override Only

You can refer to this link: https://react-native-solutions.blogspot.com/2018/07/how-to-create-react-native-app-with.html

I had the same problem. react-native link worked for me.

For more details please check this. https://github.com/sbugert/react-native-admob/issues/235

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM