React Native Expo generate apk return error: should NOT have additional property 'googleMobileAdsAppId'

Viewed 14308

I'm using ReactNative Expo for developing android/iOS app also added AdMOB via expo ADMOB sdk . Issue is when i generate apk using expo build:android -t apk . It's returning following error because of googleMobileAdsAppId field in app.json file. I'm using admob "sdkVersion": "34.0.0"

Error: Problems validating fields in app.json. See https://docs.expo.io/versions/v34.0.0/workflow/configuration/ • Field: android.config - should NOT have additional property 'googleMobileAdsAppId'. Couldn't publish because errors were found. (See logs above.) Please fix the errors and try again.

Here is my app.json file: { "expo": { "name": "AppName", "slug": "AppSlug", "privacy": "public", "sdkVersion": "34.0.0", "platforms": [ "ios", "android", "web" ], "version": "1.0.0", "orientation": "portrait", "icon": "./assets/icon.png", "splash": { "image": "./assets/splash.png", "resizeMode": "contain", "backgroundColor": "#ffffff" }, "updates": { "fallbackToCacheTimeout": 0 }, "assetBundlePatterns": [ "**/*" ], "ios": { "supportsTablet": true }, "android": { "package": "com.x.yyyyy", "config": { "googleMobileAdsAppId": "ca-app-pub-xxxxxx" } } } }

1 Answers

Well solution was pretty simple, it was because of SDK version: 34.0.0 . I just updated my current version to 35.0.0 and it works like a charm. Upgrade from SDK 34 to SDK 35:

  1. app.json, change sdkVersion to "35.0.0"
  2. In package.json, change these dependencies:

{ "react-native": "https://github.com/expo/react-native/archive/sdk-35.0.0.tar.gz", "expo": "^35.0.0", "react": "16.8.3" }

  1. Delete your project’s node_modules directory and run npm install again
  2. Also run expo r -c and npm cache clean -f to avoid any cache issue.

and that's it.

Fore more info about upgrading SDK

Related