react-native-admob: Invariant Violation: requireNativeComponent: "RNGADBannerView" was not found in the UIManager.
I recently installed admob for react-native.but i m getting an error “RNGADBannerView” was not found in the UIManager".I don’t know what that supposed to mean?
_can anyone help?_
import {AdMobBanner} from ‘react-native-admob’;
export default class Home extends Component{
render(){
return <View>
<Text>helo</Text>
<AdMobBanner
adSize="fullBanner"
adUnitID="ca-app-pub-"my_id"
onAdFailedToLoad={error => console.error(error)}
/>
</View>
}
dependencies:
"react": "16.4.1",
"react-native": "0.56.0",
"react-native-admob": "^2.0.0-beta.5",
"react-native-fbsdk": "^0.7.0",
"react-navigation": "^2.6.2"
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 2
- Comments: 28
@jasrajput, @elena87 Did you guys link admob? react-native link react-native-admob. then run your code. It is working. you can refer to this link: https://react-native-solutions.blogspot.com/2018/08/problems-related-to-admob-updated.html
I have the same problem. I followed the installation manual step by step and make sure googleMobileAds framework and React native admob linked to my app but i got the same warning: “RNGADBannerView” was not found in the UIManager.
these are my dependencies: “react”: “16.4.1”, “react-native”: “0.56.0”, “react-native-admob”: “^2.0.0-beta.5”
can any one help?
I also have the same issue on ios.
Invariant Violation: requireNativeComponent: "RNGADBannerView" was not found in the UIManager.
I tried the solutions but it did not work for me.
I tried react-native link react-native-admob. But after that, I got an error in building. I could not run the app. Please help.
did anyone found a solution for this issue?
In {adUnitID="ca-app-pub-“my_id”} you can put Sample ad Unit ID for testing or Original ad Unit Id which you might be created I use sample ad unit Id here, adUnitID=“ca-app-pub-3940256099942544/6300978111” You can refer to this link: https://react-native-solutions.blogspot.com/2018/07/how-to-create-react-native-app-with.html
"
Solved it by doing the following: Android
run
react-native link react-native-admob
this will give you the following logOpen Android Studio and go to Build -> Clean Project
Delete the app from the simulator
run
ignore it and open Android Studio Clean your project and run it from Android Studio
npx react-native start
After the bundle started if you faced this errorThis solution worked for me perfectly 👍
I did cmd+shift+k then cleaned derived-data folder and then got the problem gone
I try everything and found @nqtuyen92’s solution and it worked for me (sort of) and now error turned a yellow box error but app is running and ad is showing. Current i have this yellow box error
What i did is find build.gradle in “node_modules/react-native-admob/android” and change
compile 'com.google.android.gms:play-services-ads:+'
tocompile 'com.google.android.gms:play-services-ads:15.0.0'
UPDATE I track the yellow box error and found what caused it i modified
RNAdMobBanner.js
innode_modules\react-native-admob
i changed line 30:UIManager.RNGADBannerView.Commands.loadBanner,
toUIManager.getViewManagerConfig('RNGADBannerView').Commands.loadBanner,
now its look like this (from line 27)now there is no error and crash so far,i do not know that is the correct way but its helped me to keep developing,hope helps.(sorry for typo) my package.json
I’ve tried all the solutions written here in react-native link react-native-admob but I keep getting the same error.
Hi, i had the same issue, apparently you don´t need to press “reload” in the app for this package to work, i fixed it by just doing" react-native run-android " in the project console and then on the app the ads were showing and not giving this error. Hope i helped someone , might be a stupid solution , but if you only use adb to reload your project , this simple solution can go over your head 😉