skip to Main Content

I am experiencing this error with react-native-google-mobile-ads: https://github.com/invertase/react-native-google-mobile-ads/issues/194

My app is using an expo managed workflow with the EAS build system.

My app builds for android but fails on iOS with the following error: ios_appd_id key not found in react-native-google-mobile-ads key in app.json. App will crash without it. Which is strange because by app.json has the correct definition:

"react-native-google-mobile-ads": {
    "android_app_id": "ca-app-pub-xxx",
    "ios_app_id": "ca-app-pub-xxx",
    "user_tracking_usage_description": "This identifier will be used to deliver personalized ads to you."
  }

Regardless of how I altered my code or dependencies, this kept showing up. In an attempt to debug and find a reproducible sample I slowly built a fresh project which was created via expo init (as was my initial project). However, I am now at the point where I have literally copied every file exactly into the new, fresh app including all assets (icons, splashes) and I can not reproduce the bug at all. The two apps are exact replicas of one another (code, app.json, eas.json, package.json) In fact, the new fresh app works perfectly fine and behaves as expected in both development and production mode. I am royally confused. The error above occurs in the "run fastlane" phase of the build process.

The fastlane log with the error is here: https://pastebin.com/4cD8T3Sn
The log from the fresh app is the exact same except that the final lines of the log are success messages instead:

› Copying   ios/googleadmobtest/Supporting/Expo.plist ➜ ./Expo.plist
› Compiling googleadmobtest » SplashScreen.storyboard
› Preparing googleadmobtest » Info.plist
› Executing googleadmobtest » Bundle React Native code and images
› Generating debug googleadmobtest » googleadmobtest.app.dSYM
› Executing googleadmobtest » [CP] Copy Pods Resources
› Executing googleadmobtest » [CP-User] [RNGoogleMobileAds] Configuration
› Signing   googleadmobtest » googleadmobtest.app
› Creating  googleadmobtest » googleadmobtest.app
› Archive Succeeded
Generated plist file with the following values:
▸ -----------------------------------------
▸ {
▸   "method": "ad-hoc",
▸   "provisioningProfiles": {
▸     "com.arham23.googleadmobtest": "c88fe3cb-0ed2-427d-ae68-ec6a484dccca"
▸   },
▸   "signingStyle": "manual"
▸ }
▸ -----------------------------------------
$ /usr/bin/xcrun /usr/local/lib/ruby/gems/2.7.0/gems/fastlane-2.205.2/gym/lib/assets/wrap_xcodebuild/xcbuild-safe.sh -exportArchive -exportOptionsPlist '/var/folders/h2/gp9wlkv11lg0qj6y2mnqgc_40000gn/T/gym_config20220815-4163-q9vcsf.plist' -archivePath /Users/expo/Library/Developer/Xcode/Archives/2022-08-15/googleadmobtest 2022-08-15 23.44.51.xcarchive -exportPath '/var/folders/h2/gp9wlkv11lg0qj6y2mnqgc_40000gn/T/gym_output20220815-4163-1ishkbk' OTHER_CODE_SIGN_FLAGS="--keychain /var/folders/h2/gp9wlkv11lg0qj6y2mnqgc_40000gn/T/turtle-v2-9ac5a45d-33ef-4193-bf51-33b05b2e1e98.keychain"
Compressing 1 dSYM(s)
$ cd '/Users/expo/Library/Developer/Xcode/Archives/2022-08-15/googleadmobtest 2022-08-15 23.44.51.xcarchive/dSYMs' && zip -r '/Users/expo/workingdir/build/ios/build/googleadmobtest.app.dSYM.zip' *.dSYM
▸   adding: googleadmobtest.app.dSYM/ (stored 0%)
▸   adding: googleadmobtest.app.dSYM/Contents/ (stored 0%)
▸   adding: googleadmobtest.app.dSYM/Contents/Resources/ (stored 0%)
▸   adding: googleadmobtest.app.dSYM/Contents/Resources/DWARF/ (stored 0%)
▸   adding: googleadmobtest.app.dSYM/Contents/Resources/DWARF/googleadmobtest (deflated 75%)
▸   adding: googleadmobtest.app.dSYM/Contents/Info.plist (deflated 44%)
Successfully exported and compressed dSYM file
Successfully exported and signed the ipa file:
/Users/expo/workingdir/build/ios/build/googleadmobtest.ipa

I can provide any other information necessary, I’m somewhat new to expo and react native so I wasn’t sure what would be relevant. It seems like something is wrong with my original app’s configuration but I have no idea what the issue could be. I’d like to try deleting all the ios pods and reinstalling but the app is managed by expo and I’m unsure how to accomplish this in the expo CLI. Any help would be greatly appreciated.

2

Answers


  1. To get around this error, I split the config into two files. Expo by default loads app.config.json over app.json and react-native-google-mobile-ads reads app.json

    app.json

    { 
        "react-native-google-mobile-ads": {
            ...app ids
        }
    }
    

    app.config.json

    {
        "expo": {
            "name": ...
            ...
        }
    }
    
    Login or Signup to reply.
  2. I got the same issue then I tried to split app.json into 2 parts like this:
    In the app.json, before copying and pasting the following code

    {
     "react-native-google-mobile-ads": {
        "android_app_id": "ca-app-pub-xxxxxxxx~xxxxxxxx",
        "ios_app_id": "ca-app-pub-xxxxxxxx~xxxxxxxx"
     }
    }
    

    from the https://docs.page/invertase/react-native-google-mobile-ads#configure-outbound-requests
    I moved
    "name": "...", "displayName": "...",
    to a new file named app.config.json is the same directory as app.json.
    Conclusion:
    app.json

    {
    "react-native-google-mobile-ads": {
        "android_app_id": "ca-app-pub-xxxxxxxx~xxxxxxxx",
        "ios_app_id": "ca-app-pub-xxxxxxxx~xxxxxxxx"
      }
    }
    

    app.config.json

    {
     "name": "...",
      "displayName": "...",
    }
    

    Note that: because you changed the app.json -> app.config.json so wherever you implement data from app.json you need to change to app.config,json
    For example in my index.js has a line import {name as appName} from ‘./app.json’ change it in to import {name as appName} from ‘./app.config.json’
    Wish you guys will solve this problem, thank you.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search