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
625 stars 121 forks source link

[🐛] EAS build failing because of missing ios_app_id in app.json #581

Open BrodaNoel opened 1 month ago

BrodaNoel commented 1 month ago

What happened?

I'm building using eas build -p ios, and I'm getting this error:

❌  error: ios_app_id key not found in react-native-google-mobile-ads key in app.json. App will crash without it.

Consider that this error is suddenly happening after I upgraded to Expo SDK 51.

⚠️  ld: ignoring duplicate libraries: '-lc++'
› Generating debug NoFilter » NoFilter.app.dSYM
› Executing NoFilter » Bundle React Native code and images
    Bundler cache is empty, rebuilding (this may take a minute)
› Executing NoFilter » [CP] Copy Pods Resources
› Executing NoFilter » Upload Debug Symbols to Sentry
› Executing NoFilter » [CP] Embed Pods Frameworks
› Executing NoFilter » [CP-User] [RNFB] Core Configuration
      A firebase.json file was not found, whilst this file is optional it is recommended to include it to configure firebase services in React Native Firebase.
› Executing NoFilter » [CP-User] [RNGoogleMobileAds] Configuration

❌  error: ios_app_id key not found in react-native-google-mobile-ads key in app.json. App will crash without it.

⚠️  Script has ambiguous dependencies causing it to run on every build.
   To fix, go to: Xcode » NoFilter/NoFilter » Build Phases » 'Upload Debug Symbols to Sentry'
   Either: Uncheck "Based on dependency analysis", or select output files to trigger the script
⚠️  Script has ambiguous dependencies causing it to run on every build.
   To fix, go to: Xcode » NoFilter/NoFilter » Build Phases » '[CP-User] [RNFB] Core Configuration'
   Either: Uncheck "Based on dependency analysis", or select output files to trigger the script
⚠️  Script has ambiguous dependencies causing it to run on every build.
   To fix, go to: Xcode » NoFilter/NoFilter » Build Phases » '[CP-User] [RNGoogleMobileAds] Configuration'
   Either: Uncheck "Based on dependency analysis", or select output files to trigger the script
    Run script build phase 'Create Symlinks to Header Folders' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'React-RuntimeApple' fr
▸ ** ARCHIVE FAILED **
▸ The following build commands failed:
▸   PhaseScriptExecution [CP-User]\ [RNGoogleMobileAds]\ Configuration /Users/expo/Library/Developer/Xcode/DerivedData/NoFilter-fjavmkobuxfkzfckwbwnupmjterw/Build/Intermediates.noindex/ArchiveIntermediates/NoFilter/IntermediateBuildFilesPath/NoFilter.build/Release-iphoneos/NoFilter.build/Script-F562EEB2DBB1EB63B1F226D6.sh (in target 'NoFilter' from project 'NoFilter')
▸ (1 failure)
** ARCHIVE FAILED **
The following build commands failed:
    PhaseScriptExecution [CP-User]\ [RNGoogleMobileAds]\ Configuration /Users/expo/Library/Developer/Xcode/DerivedData/NoFilter-fjavmkobuxfkzfckwbwnupmjterw/Build/Intermediates.noindex/ArchiveIntermediates/NoFilter/IntermediateBuildFilesPath/NoFilter.build/Release-iphoneos/NoFilter.build/Script-F562EEB2DBB1EB63B1F226D6.sh (in target 'NoFilter' from project 'NoFilter')
(1 failure)

Exit status: 65

Now, the weird thing is that I have, and I always had (it was working before) the ios_app_id in my app.json. Like this:

{
  "expo": {
    ...
  },
  "react-native-google-mobile-ads": {
    "android_app_id": "ca-app-pub-3342214521741372~6205894661",
    "ios_app_id": "ca-app-pub-3342214521741372~3029422209",
    "user_tracking_usage_description": "This identifier will be used to deliver personalized ads to you",
    "sk_ad_network_items": [
      "cstr6suwn9.skadnetwork",
      "4fzdc2evr5.skadnetwork",
      "4pfyvq9l8r.skadnetwork",
      "2fnua5tdw4.skadnetwork",
      "ydx93a7ass.skadnetwork",
      "5a6flpkh64.skadnetwork",
      "p78axxw29g.skadnetwork",
      "v72qych5uu.skadnetwork",
      "ludvb6z3bs.skadnetwork",
      "cp8zw746q7.skadnetwork",
      "3sh42y64q3.skadnetwork",
      "c6k4g5qg8m.skadnetwork",
      "s39g8k73mm.skadnetwork",
      "3qy4746246.skadnetwork",
      "f38h382jlk.skadnetwork",
      "hs6bdukanm.skadnetwork",
      "v4nxqhlyqp.skadnetwork",
      "wzmmz9fp6w.skadnetwork",
      "yclnxrl5pm.skadnetwork",
      "t38b2kh725.skadnetwork",
      "7ug5zh24hu.skadnetwork",
      "gta9lk7p23.skadnetwork",
      "vutu7akeur.skadnetwork",
      "y5ghdn5j9k.skadnetwork",
      "n6fk4nfna4.skadnetwork",
      "v9wttpbfk9.skadnetwork",
      "n38lu8286q.skadnetwork",
      "47vhws6wlr.skadnetwork",
      "kbd757ywx3.skadnetwork",
      "9t245vhmpl.skadnetwork",
      "eh6m2bh4zr.skadnetwork",
      "a2p9lx4jpn.skadnetwork",
      "22mmun2rn5.skadnetwork",
      "4468km3ulz.skadnetwork",
      "2u9pt9hc89.skadnetwork",
      "8s468mfl3y.skadnetwork",
      "klf5c3l5u5.skadnetwork",
      "ppxm28t8ap.skadnetwork",
      "ecpz2srf59.skadnetwork",
      "uw77j35x4d.skadnetwork",
      "pwa73g5rt2.skadnetwork",
      "mlmmfzh3r3.skadnetwork",
      "578prtvx9j.skadnetwork",
      "4dzt52r2t5.skadnetwork",
      "e5fvkxwrpn.skadnetwork",
      "8c4e2ghe7u.skadnetwork",
      "zq492l623r.skadnetwork",
      "3rd42ekr43.skadnetwork",
      "3qcr597p9d.skadnetwork"
    ]
  }
}

Platforms

iOS, but have not tested behavior on Android

React Native Info

Consider that this build is being made on Expo EAS servers. Not in my local env.

System:
  OS: macOS 12.7.5
  CPU: (4) x64 Intel(R) Core(TM) i5-5257U CPU @ 2.70GHz
  Memory: 118.20 MB / 8.00 GB
  Shell:
    version: 5.8.1
    path: /bin/zsh
Binaries:
  Node:
    version: 20.11.1
    path: ~/.nvm/versions/node/v20.11.1/bin/node
  Yarn:
    version: 1.22.19
    path: ~/.yarn/bin/yarn
  npm:
    version: 10.2.4
    path: ~/.nvm/versions/node/v20.11.1/bin/npm
  Watchman:
    version: 2024.04.15.00
    path: /usr/local/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /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: 2023.2 AI-232.10300.40.2321.11668458
  Xcode:
    version: 14.2/14C18
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.11
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.74.1
    wanted: 0.74.1
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: Not found
  newArchEnabled: Not found
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found

Are your using Typescript?

package.json

{
  "name": "no-filter-app",
  "version": "19.72.0",
  "private": true,
  "devDependencies": {
    "@babel/core": "^7.20.0",
    "@google-cloud/translate": "^6.1.0",
    "babel-eslint": "^10.1.0",
    "eslint": "^8.22.0",
    "eslint-plugin-react": "^7.31.0",
    "eslint-plugin-react-native": "^4.0.0",
    "patch-package": "^6.4.7",
    "postinstall-postinstall": "^2.1.0"
  },
  "main": "./node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start --dev-client",
    "generate-i18n": "node ./generate-i18n.js",
    "update-changelogs": "node ./update-changelogs.js",
    "postinstall": "patch-package",
    "build:develop": "eas build --profile development -p ios"
  },
  "dependencies": {
    "@amplitude/analytics-react-native": "^1.4.8",
    "@expo/react-native-action-sheet": "^4.1.0",
    "@react-native-async-storage/async-storage": "1.23.1",
    "@react-native-community/netinfo": "11.3.1",
    "@react-native-firebase/analytics": "^19.2.2",
    "@react-native-firebase/app": "^19.2.2",
    "@react-native-google-signin/google-signin": "^11.0.1",
    "@sentry/react-native": "~5.22.0",
    "country-emoji": "^1.5.6",
    "duix": "^3.0.3",
    "expo": "~51.0.8",
    "expo-apple-authentication": "~6.4.1",
    "expo-application": "~5.9.1",
    "expo-background-fetch": "~12.0.1",
    "expo-build-properties": "~0.12.1",
    "expo-clipboard": "~6.0.3",
    "expo-constants": "~16.0.1",
    "expo-dev-client": "~4.0.14",
    "expo-device": "~6.0.2",
    "expo-file-system": "~17.0.1",
    "expo-font": "~12.0.5",
    "expo-image": "~1.12.9",
    "expo-image-picker": "~15.0.5",
    "expo-linking": "~6.3.1",
    "expo-localization": "~15.0.3",
    "expo-location": "~17.0.1",
    "expo-media-library": "~16.0.3",
    "expo-notifications": "~0.28.3",
    "expo-quick-actions": "^2.0.0",
    "expo-splash-screen": "~0.27.4",
    "expo-store-review": "~7.0.2",
    "expo-task-manager": "~11.8.1",
    "expo-tracking-transparency": "~4.0.2",
    "expo-updates": "~0.25.14",
    "i18n-js": "^3.7.1",
    "lodash": "^4.17.21",
    "react": "18.2.0",
    "react-native": "0.74.1",
    "react-native-fbsdk-next": "^12.2.0",
    "react-native-gesture-handler": "~2.16.1",
    "react-native-google-mobile-ads": "^13.6.0",
    "react-native-maps": "1.14.0",
    "react-native-purchases": "^7.27.2",
    "react-native-reanimated": "~3.10.1",
    "react-native-reanimated-carousel": "4.0.0-alpha.12",
    "react-native-render-html": "^6.3.4",
    "react-native-safe-area-context": "4.10.1",
    "react-native-svg": "15.2.0",
    "react-native-uuid": "^2.0.2",
    "rn-prompt": "^1.0.4",
    "sanitize-html": "^2.13.0",
    "sunrise-sunset-js": "^2.2.1",
    "use-interval": "^1.4.0"
  }
}

app.json

{
  "expo": {
    "name": "NoFilter",
    "version": "19.72.0",
    "description": "NoFilter helps photographers and travelers to find the best photo spots nearby, and all around the world",
    "icon": "src/styles/imgs/nofilter-icon.png",
    "orientation": "portrait",
    "primaryColor": "#ffffff",
    "splash": {
      "backgroundColor": "#000",
      "resizeMode": "cover",
      "image": "src/styles/imgs/splash-screen-ph.png"
    },
    "notification": {
      "icon": "src/styles/imgs/noti-icon.png"
    },
    "locales": {
      "ar": "./locales/ar.json",
      "bg": "./locales/bg.json",
      "ca": "./locales/ca.json",
      "cs": "./locales/cs.json",
      "de": "./locales/de.json",
      "en": "./locales/en.json",
      "es": "./locales/es.json",
      "fr": "./locales/fr.json",
      "hi": "./locales/hi.json",
      "hr": "./locales/hr.json",
      "id": "./locales/id.json",
      "is": "./locales/is.json",
      "it": "./locales/it.json",
      "ja": "./locales/ja.json",
      "ms": "./locales/ms.json",
      "nl": "./locales/nl.json",
      "pl": "./locales/pl.json",
      "pt": "./locales/pt.json",
      "ru": "./locales/ru.json",
      "tr": "./locales/tr.json",
      "vi": "./locales/vi.json",
      "zh": "./locales/zh.json"
    },
    "slug": "xx",
    "scheme": "nofilter",
    "jsEngine": "hermes",
    "plugins": [
      [
        "@sentry/react-native/expo",
        {
          "organization": "xx",
          "project": "xxx",
          "setCommits": true
        }
      ],
      "@react-native-google-signin/google-signin",
      [
        "expo-media-library",
        {
          "photosPermission": "We use your library when you want to upload a photo to your feed, or a new profile picture",
          "savePhotosPermission": "We use your library when you want to upload a photo to your feed, or a new profile picture",
          "isAccessMediaLocationEnabled": true
        }
      ],
      [
        "react-native-fbsdk-next",
        {
          "appID": "xxx",
          "clientToken": "xxx",
          "displayName": "NoFilter",
          "advertiserIDCollectionEnabled": false,
          "autoLogAppEventsEnabled": false,
          "isAutoInitEnabled": false,
          "iosUserTrackingPermission": false
        }
      ],
      "./plugins/",
      "@react-native-firebase/app",
      [
        "expo-build-properties",
        {
          "ios": {
            "useFrameworks": "static"
          }
        }
      ],
      "expo-localization",
      [
        "expo-tracking-transparency",
        {
          "userTrackingPermission": "This identifier will be used to deliver personalized ads to you"
        }
      ],
      [
        "expo-font",
        {
          "fonts": [
            "src/styles/fonts/Montserrat/Montserrat-Regular.ttf",
            "src/styles/fonts/Montserrat/Montserrat-Medium.ttf",
            "src/styles/fonts/Montserrat/Montserrat-SemiBold.ttf"
          ]
        }
      ],
      [
        "expo-quick-actions",
        {
          "androidIcons": {
            "help_icon": {
              "foregroundImage": "src/styles/imgs/android-adaptive-foreground.png",
              "backgroundColor": "#000000"
            }
          },
          "iosActions": [
            {
              "title": "Wait! Don't delete me!",
              "subtitle": "Tell me what happened",
              "icon": "symbol:person.crop.circle.badge.questionmark",
              "id": "0",
              "params": {
                "href": "/about-to-remove"
              }
            }
          ]
        }
      ]
    ],
    "updates": {
      "enabled": false,
      "url": "xxxx"
    },
    "ios": {
      "buildNumber": "19.72.0",
      "supportsTablet": true,
      "googleServicesFile": "./GoogleService-Info.plist",
      "bundleIdentifier": "app.no-filter.nofilter",
      "appStoreUrl": "https://itunes.apple.com/us/app/nofilter-photo-spots/id1445583976",
      "usesAppleSignIn": true,
      "config": {
        "usesNonExemptEncryption": false,
        "googleMapsApiKey": "xxxx"
      },
      "infoPlist": {
        "NSUserTrackingUsageDescription": "This identifier will be used to deliver personalized ads to you",
        "NSLocationWhenInUseUsageDescription": "We use your location to see how far you are from spots, and also to show you your position in the map",
        "NSPhotoLibraryUsageDescription": "We use your library when you want to upload a photo to your feed, or a new profile picture",
        "NSPhotoLibraryAddUsageDescription": "We use your library when you want to upload a photo to your feed, or a new profile picture",
        "CFBundleAllowMixedLocalizations": true,
        "SKAdNetworkItems": [
          {
            "SKAdNetworkIdentifier": "xxxx"
          },
          {
            "SKAdNetworkIdentifier": "xxx"
          }
        ],
        "LSApplicationQueriesSchemes": [
          "instagram",
          "twitter"
        ]
      }
    },
    "android": {
      "versionCode": 483,
      "package": "app.no_filter.nofilter",
      "playStoreUrl": "https://play.google.com/store/apps/details?id=app.no_filter.nofilter",
      "icon": "src/styles/imgs/nofilter-icon-android.png",
      "adaptiveIcon": {
        "foregroundImage": "src/styles/imgs/android-adaptive-foreground.png",
        "backgroundColor": "#000000"
      },
      "config": {
        "googleMaps": {
          "apiKey": "xxxx"
        }
      },
      "googleServicesFile": "./google-services.json",
      "permissions": [
        "ACCESS_COARSE_LOCATION",
        "ACCESS_FINE_LOCATION",
        "READ_EXTERNAL_STORAGE",
        "WRITE_EXTERNAL_STORAGE",
        "ACCESS_MEDIA_LOCATION",
        "android.permission.READ_EXTERNAL_STORAGE",
        "android.permission.WRITE_EXTERNAL_STORAGE",
        "android.permission.ACCESS_MEDIA_LOCATION",
        "android.permission.INTERNET",
        "com.google.android.gms.permission.AD_ID"
      ],
      "blockedPermissions": [
        "android.permission.CAMERA",
        "android.permission.RECORD_AUDIO"
      ]
    },
    "platforms": [
      "android",
      "ios"
    ],
    "extra": {
      "eas": {
        "projectId": "xxxx"
      }
    },
    "runtimeVersion": {
      "policy": "appVersion"
    },
    "owner": "brodanoel"
  },
  "react-native-google-mobile-ads": {
    "android_app_id": "ca-app-pub-3342214521741372~6205894661",
    "ios_app_id": "ca-app-pub-3342214521741372~3029422209",
    "user_tracking_usage_description": "This identifier will be used to deliver personalized ads to you",
    "sk_ad_network_items": [
      "cstr6suwn9.skadnetwork",
      "4fzdc2evr5.skadnetwork",
      "4pfyvq9l8r.skadnetwork",
      "2fnua5tdw4.skadnetwork",
      "ydx93a7ass.skadnetwork",
      "5a6flpkh64.skadnetwork",
      "p78axxw29g.skadnetwork",
      "v72qych5uu.skadnetwork",
      "ludvb6z3bs.skadnetwork",
      "cp8zw746q7.skadnetwork",
      "3sh42y64q3.skadnetwork",
      "c6k4g5qg8m.skadnetwork",
      "s39g8k73mm.skadnetwork",
      "3qy4746246.skadnetwork",
      "f38h382jlk.skadnetwork",
      "hs6bdukanm.skadnetwork",
      "v4nxqhlyqp.skadnetwork",
      "wzmmz9fp6w.skadnetwork",
      "yclnxrl5pm.skadnetwork",
      "t38b2kh725.skadnetwork",
      "7ug5zh24hu.skadnetwork",
      "gta9lk7p23.skadnetwork",
      "vutu7akeur.skadnetwork",
      "y5ghdn5j9k.skadnetwork",
      "n6fk4nfna4.skadnetwork",
      "v9wttpbfk9.skadnetwork",
      "n38lu8286q.skadnetwork",
      "47vhws6wlr.skadnetwork",
      "kbd757ywx3.skadnetwork",
      "9t245vhmpl.skadnetwork",
      "eh6m2bh4zr.skadnetwork",
      "a2p9lx4jpn.skadnetwork",
      "22mmun2rn5.skadnetwork",
      "4468km3ulz.skadnetwork",
      "2u9pt9hc89.skadnetwork",
      "8s468mfl3y.skadnetwork",
      "klf5c3l5u5.skadnetwork",
      "ppxm28t8ap.skadnetwork",
      "ecpz2srf59.skadnetwork",
      "uw77j35x4d.skadnetwork",
      "pwa73g5rt2.skadnetwork",
      "mlmmfzh3r3.skadnetwork",
      "578prtvx9j.skadnetwork",
      "4dzt52r2t5.skadnetwork",
      "e5fvkxwrpn.skadnetwork",
      "8c4e2ghe7u.skadnetwork",
      "zq492l623r.skadnetwork",
      "3rd42ekr43.skadnetwork",
      "3qcr597p9d.skadnetwork"
    ]
  }
}

ios/Podfile

Not visible on Expo

android/build.gradle

Not visible on Expo

android/app/build.gradle

Not visible on Expo

android/settings.gradle

Not visible on Expo

AndroidManifest.xml

Not visible on Expo
BrodaNoel commented 1 month ago

Is maybe EAS removing it?

Screen Shot 2024-05-24 at 02 57 57
BrodaNoel commented 1 month ago

Is this something related? https://github.com/expo/fyi/blob/main/root-expo-object.md#migrating-the-config

There were some changes in app.json since SDK 51

toadfanszz commented 1 month ago

@BrodaNoel

I'm having the same problem, do you have a solution for this?

BrodaNoel commented 1 month ago

@toadfansboy nop... not yet... I'mw waiting for some response here. My builds are totally blocked by this 🤷‍♂️

BrodaNoel commented 1 month ago

@toadfansboy have you found any workaround here? I still have my releases blocked because of this. I'm considering removing the Ads until it gets fixed.

maximebaudoin commented 3 weeks ago

Infortunately I'm thinking of doing the same thing as @BrodaNoel... Do you know which previous version would resolve this problem? 🤞

BrodaNoel commented 3 weeks ago

@maximebaudoin the only option would be to roll back to Expo SDK 50.

I am right now trying some workarounds for this. If I get some luck, I'll let your know

maximebaudoin commented 3 weeks ago

@maximebaudoin the only option would be to roll back to Expo SDK 50.

I am right now trying some workarounds for this. If I get some luck, I'll let your know

I don't know if I'm the only one, but with Expo SDK 50, I have the same problem. In fact, I have this problem from a minimum 1 or 2 months ago.

BrodaNoel commented 3 weeks ago

I just tried this, and it worked on iOS. I'm right now waiting for the Android build.

https://github.com/invertase/react-native-google-mobile-ads/pull/584

Right now, I'm duplicating all the configuration (react-native-google-mobile-ads) in 2 places:

  1. I keep the root > react-native-google-mobile-ads key in the root of app.json
  2. I added all the same config inside root > expo > extra > react-native-google-mobile-ads in app.json
jb9229 commented 3 weeks ago

@BrodaNoel how about android build?

Your guide is not work in iOS(root and root > expo > extra)

BrodaNoel commented 3 weeks ago

@jb9229 but have you applied the patches from the PR as well?

jb9229 commented 3 weeks ago

Can I patch "ios_config.sh"? pr

BrodaNoel commented 3 weeks ago

You can implement "patch-package" (look for the NPM package).

You make the changes in node_modules and then run

'npx patch-package react-native-google-mobile-ads'

Then you need to as patch-package as a dependency in your package.json, and configure it to auto-run it post install.

Sorry I can't give more details. I'm away from the computer.

jb9229 commented 3 weeks ago

I tried many times, but I failed...; @BrodaNoel

  1. changed 'ios_config.sh' , also setting patch-package image image image
BrodaNoel commented 3 weeks ago

@jb9229 are you also copying all the config inside root > expo > extra ?

The key should be something like: root > expo > extra > react-native-google-mobile-ads > ios_app_id

jb9229 commented 3 weeks ago

yes, i did

image

BrodaNoel commented 3 weeks ago

@jb9229 you are on Expo SDK 51, right?

jb9229 commented 3 weeks ago

@BrodaNoel

definitly right

BrodaNoel commented 3 weeks ago

Look, it really seems like you have everything exactly like my configuration, so, double check if this isn't a cache problem

BrodaNoel commented 3 weeks ago

You have this dependency installed, right?

"patch-package": "^6.4.7",
"postinstall-postinstall": "^2.1.0"
BrodaNoel commented 3 weeks ago

Check in the logs if after the yarn install there is a text saying something like: "The patches were applied for package xxxx"

jb9229 commented 3 weeks ago

this is yarn install

image

maximebaudoin commented 3 weeks ago

@maximebaudoin the only option would be to roll back to Expo SDK 50.

Hi, I tried to go back to Expo@50.x.x but the problem was still present despite several hours of testing and deleting and reinstalling the node_modules.

You can implement "patch-package" (look for the NPM package).

You make the changes in node_modules and then run

'npx patch-package react-native-google-mobile-ads'

Then you need to as patch-package as a dependency in your package.json, and configure it to auto-run it post install.

Sorry I can't give more details. I'm away from the computer.

When I see your messages, I tested earlier by going back to Expo@51.x.x and applying the patch as explained above. And the error is still there.

I specify that I follow all the instructions to the letter and test by executing the npx expo run:ios command.

Am I forgetting something glaring ? I don't know...

trimination commented 3 weeks ago

@jb9229 it's hard to tell from your screenshot but it looks like your "react-native-google-mobile-ads" key is outside of the "extra" key. It looks like you have something like:

"extra": {
},
"react-native-google-mobile-ads": {
 }

instead of:

"extra": {
    "react-native-google-mobile-ads": {
    }
}

Can confirm that this patch, at least via manually updating ios_config.sh, works as intended.

BrodaNoel commented 3 weeks ago

It seems to be inside extra 🤔

Why don't you try to build on EAS servers, instead of in your local? That's what I am doing

trimination commented 3 weeks ago

It seems to be inside extra 🤔

Why don't you try to build on EAS servers, instead of in your local? That's what I am doing

Apologies, I only saw the react-native-google-mobile-ads object at the end of the screenshot, I overlooked the one inside extra. I'm not using EAS, but local build on physical device is working for me for iOS. Thank you for your patch 👌

DoctorJohn commented 1 week ago

Are you guys having both app.json and app.config.js files?

If so, this might be the problem. PR #517 broke this case and PR #521 is supposed to fix it, but seems to come with more issued. In my projects I'm using the following patch (and apply it with patch-package). It basically reverts the behaviour of PR #517 by only looking at the app.js file.

diff --git a/node_modules/react-native-google-mobile-ads/ios_config.sh b/node_modules/react-native-google-mobile-ads/ios_config.sh
index b57451a..1df22c1 100755
--- a/node_modules/react-native-google-mobile-ads/ios_config.sh
+++ b/node_modules/react-native-google-mobile-ads/ios_config.sh
@@ -93,7 +93,7 @@ while true; do

   echo "info:      ($_CURRENT_LOOKUPS of $_MAX_LOOKUPS) Searching in '$_CURRENT_SEARCH_DIR' for a ${_JSON_FILE_NAME}/${_JS_APP_CONFIG_FILE_NAME} file."

-  _SEARCH_RESULT=$(find "$_CURRENT_SEARCH_DIR" -maxdepth 2 \( -name ${_JSON_FILE_NAME} -o -name ${_JS_APP_CONFIG_FILE_NAME} \) -print | /usr/bin/head -n 1)
+  _SEARCH_RESULT=$(find "$_CURRENT_SEARCH_DIR" -maxdepth 2 -name ${_JSON_FILE_NAME} -print | /usr/bin/head -n 1)

   if [[ "$(basename ${_SEARCH_RESULT})" = "${_JS_APP_CONFIG_FILE_NAME}" ]]; then
     _IS_CONFIG_JS=true
claudiofus commented 4 days ago

I have an iOS and Android app, with root > expo > react-native-google-mobile-ads, I'm able to build successfully for iOS with EAS and locally. The same app.json fails for Android:

ERROR: react-native-google-mobile-ads requires an 'android_app_id' property inside a 'react-native-google-mobile-ads' key in your app.json.
  No android_app_id property was found in this location. The native Google Mobile Ads SDK will crash on startup without it.

I've tried to include react-native-google-mobile-ads in extra or keep both inside and outside but isn't working for Android.

Last chance is patch-package as suggested but I didn't had time to test it.