I would like to use react native google ad mob but I have this error that bothers me a lot:
Error: Requiring module "node_modules\react-native-google-mobile-ads\index.ts", which threw an exception: Invariant violation: Your JavaScript code tried to access a native module that does not exist.
I tried to change the versions of react native and react that was installed, it did not work. here is my package.json :
{
"name": "front",
"version": "1.0.0",
"scripts": {
"start": "expo start --dev-client",
"android": "expo run:android",
"ios": "expo run:ios",
"web": "expo start --web"
},
"dependencies": {
"@expo/vector-icons": "^13.0.0",
"@react-navigation/drawer": "^6.5.7",
"@react-navigation/native": "^6.1.2",
"@react-navigation/native-stack": "^6.9.8",
"@types/react-native": "^0.71.1",
"axios": "^1.2.2",
"expo": "~47.0.12",
"expo-build-properties": "~0.4.1",
"expo-dev-client": "~2.0.1",
"expo-secure-store": "~12.0.0",
"expo-splash-screen": "~0.17.5",
"expo-status-bar": "^1.4.2",
"react": "^17.0.2",
"react-native": "^0.68.2",
"react-native-animated-loader": "^1.0.0",
"react-native-gesture-handler": "~2.8.0",
"react-native-google-mobile-ads": "7.0.1",
"react-native-infinite-scroll-view": "^0.4.5",
"react-native-keyboard-aware-scroll-view": "^0.9.5",
"react-native-reanimated": "~2.12.0",
"react-native-safe-area-context": "4.4.1",
"react-native-screens": "~3.18.0",
"react-native-toast-message": "^2.1.5",
"react-navigation": "^4.4.4",
"react-router": "^6.6.2"
},
"devDependencies": {
"@babel/core": "^7.12.9",
"react-native-secure-store": "^1.0.3"
},
"private": true
}
and here is my app.json :
{
"expo": {
"name": "Front",
"slug": "Front",
"version": "1.0.0",
"orientation": "portrait",
"icon": "./assets/icon.png",
"userInterfaceStyle": "light",
"splash": {
"image": "./assets/splash.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": [
"**/*"
],
"ios": {
"supportsTablet": true,
"bundleIdentifier": "y"
},
"android": {
"adaptiveIcon": {
"foregroundImage": "./assets/adaptive-icon.png",
"backgroundColor": "#FFFFFF"
},
"package": "com.knowz.front"
},
"web": {
"favicon": "./assets/favicon.png"
},
"extra": {
"eas": {
"projectId": "046da7b1-068c-4845-a69c-fe0a92be1b15"
}
},
"owner": "knowz"
},
"react-native-google-mobile-ads": {
"android_app_id": "ca-app-pub-2973173763441523~2444055698",
"ios_app_id": "ca-app-pub-2973173763441523~5693853805"
}
}