invertase / react-native-google-mobile-ads

React Native Google Mobile Ads enables you to monetize your app with AdMob.
https://docs.page/invertase/react-native-google-mobile-ads
Other
701 stars 142 forks source link

[🐛] Bug Report Title - ios_app_id key not found in react-native-google-mobile-ads #353

Closed IrynaBt closed 1 year ago

IrynaBt commented 1 year ago

What happened?

When I try to run application I get this error: ios_app_id key not found in react-native-google-mobile-ads key in app.json. App will crash without it.

Platforms

iOS, but have not tested behavior on Android

React Native Info

System:
    OS: macOS 13.2.1
    CPU: (12) x64 Apple M2 Max
    Memory: 126.09 MB / 32.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 19.8.1 - /usr/local/bin/node
    Yarn: 1.22.18 - /usr/local/bin/yarn
    npm: 9.5.1 - /usr/local/bin/npm
    Watchman: 2023.03.20.00 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.11.3 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1
    Android SDK: Not Found
  IDEs:
    Android Studio: 2022.1 AI-221.6008.13.2211.9619390
    Xcode: 14.2/14C18 - /usr/bin/xcodebuild
  Languages:
    Java: 13.0.1 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.1.0 => 18.1.0 
    react-native: 0.70.6 => 0.70.6 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Are your using Typescript?

package.json

{
  "name": "xxx",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint ."
  },
  "dependencies": {
    "@invertase/react-native-apple-authentication": "^2.2.2",
    "@react-native-community/async-storage": "^1.12.1",
    "@react-native-community/push-notification-ios": "^1.10.1",
    "@react-native-firebase/analytics": "^16.4.6",
    "@react-native-firebase/app": "^16.4.6",
    "@react-native-firebase/auth": "^16.5.0",
    "@react-native-firebase/crashlytics": "^16.4.6",
    "@react-native-firebase/firestore": "^16.4.6",
    "@react-native-firebase/messaging": "^16.4.6",
    "@react-native-google-signin/google-signin": "^9.0.2",
    "@react-native-picker/picker": "^2.4.8",
    "@react-navigation/native": "^6.1.0",
    "@react-navigation/native-stack": "^6.9.5",
    "check-tool": "^1.0.5",
    "date-fns": "^2.29.3",
    "i18n-js": "^3.8.0",
    "lodash": "^4.17.21",
    "moment": "^2.29.4",
    "react": "18.1.0",
    "react-native": "0.70.6",
    "react-native-config": "^1.4.11",
    "react-native-device-info": "^10.3.0",
    "react-native-gesture-handler": "^2.8.0",
    "react-native-google-mobile-ads": "^10.0.1",
    "react-native-iap": "^12.7.3",
    "react-native-linear-gradient": "^2.6.2",
    "react-native-localize": "^2.2.4",
    "react-native-rate": "^1.2.10",
    "react-native-safe-area-context": "^4.4.1",
    "react-native-screens": "^3.18.2",
    "react-native-select-dropdown": "^3.2.1",
    "react-native-shake": "^5.1.1",
    "react-native-splash-screen": "^3.3.0",
    "react-native-svg": "^13.6.0",
    "react-native-uuid": "^2.0.1",
    "react-navigation": "^4.4.4",
    "react-redux": "^8.0.5",
    "redux": "^4.2.0",
    "redux-logger": "^3.0.6",
    "redux-persist": "^6.0.0",
    "redux-thunk": "^2.4.2"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9",
    "@babel/runtime": "^7.12.5",
    "@react-native-community/eslint-config": "^2.0.0",
    "babel-eslint": "^10.1.0",
    "babel-jest": "^26.6.3",
    "eslint": "^7.32.0",
    "eslint-config-prettier": "^8.6.0",
    "eslint-formatter-gitlab": "^4.0.0",
    "eslint-plugin-functional": "^4.4.1",
    "eslint-plugin-import": "^2.27.4",
    "eslint-plugin-prettier": "^4.2.1",
    "eslint-plugin-react": "^7.32.0",
    "eslint-plugin-react-hooks": "^4.6.0",
    "eslint-plugin-simple-import-sort": "^8.0.0",
    "jest": "^26.6.3",
    "metro-react-native-babel-preset": "0.72.3",
    "prettier": "^2.8.1",
    "react-test-renderer": "18.1.0"
  },
  "jest": {
    "preset": "react-native"
  }
}

app.json

{
  "name": "xxx",
  "displayName": "xxx",
  "react-native-google-mobile-ads": {
    "android_app_id": "ca-app-pub-2865003755518837~7713376168",
    "ios_app_id": "ca-app-pub-2865003755518837~5306064048"
  }
}

ios/Podfile

No response

android/build.gradle

No response

android/app/build.gradle

No response

android/settings.gradle

No response

AndroidManifest.xml

No response

mikehardy commented 1 year ago

app.json looks good based on quick comparison visually with our example https://github.com/invertase/react-native-google-mobile-ads/blob/main/RNGoogleMobileAdsExample/app.json

My guess is that you need to do a pod install in order to munge the app.json (via our custom build steps...) into the iOS App's metadata, as that is part of the machinery that transmits the app.json contents into the running app

IrynaBt commented 1 year ago

It does not help.

alqubo commented 1 year ago

Hi @mikehardy @IrynaBt

I just upgraded to the latest release v10.3.1 for support SKAdNetwork and I am also getting the same error "ios_app_id key not found in react-native-google-mobile-ads" key in app.json when trying to build the app for iOS.

In the previous version (v10.2.0) that I had, it was working fine.

This is my app.json:

{
  "name": "abc",
  "displayName": "abc",
  "react-native-google-mobile-ads": {
    "android_app_id": "androidId",
    "ios_app_id": "iosId",
    "optimize_initialization": true,
    "optimize_ad_loading": true,
    "user_tracking_usage_description": "This identifier will be used to deliver personalized ads to you.",
    "sk_ad_network_items": [
      "....skadnetwork",
      "....skadnetwork",
    ]
  }
}

Any ideas? Thanks.

alqubo commented 1 year ago

Fixed!

In my case, there is an extra comma at the end of sk_ad_network_items. Make sure you have the JSON well-formed.

IrynaBt commented 1 year ago

In my case it was necessary to update ruby version to 2.6.6

github-actions[bot] commented 1 year ago

Hello 👋, to help manage issues we automatically close stale issues.

This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?

This issue will be closed in 15 days if no further activity occurs.

Thank you for your contributions.

themohitkhandal commented 3 months ago

Still getting this issue