React Native Expo generate apk return error: should NOT have additional property 'googleMobileAdsAppId'
React Native Expo generate apk return error: should NOT have additional property 'googleMobileAdsAppId'
我正在使用 ReactNative Expo 开发 android/iOS 应用程序,还通过 expo ADMOB sdk 添加了 AdMOB。问题是当我使用 expo build:android -t apk
生成 apk 时。由于 app.json
文件中的 googleMobileAdsAppId
字段,它返回以下错误。我正在使用 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.
这是我的 app.json
文件:
{
"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"
}
}
}
}
嗯,解决方案很简单,因为 SDK version: 34.0.0
。我刚刚将当前版本更新为 35.0.0
,它非常有用。
从 SDK 34 升级到 SDK 35:
app.json
,将sdkVersion
改为"35.0.0"
- 在
package.json
中,更改这些依赖项:
{
"react-native": "https://github.com/expo/react-native/archive/sdk-35.0.0.tar.gz",
"expo": "^35.0.0",
"react": "16.8.3"
}
- 删除项目的 node_modules 目录并 运行 npm install 再次
- 还有 运行
expo r -c
和 npm cache clean -f
以避免任何缓存问题。
就是这样。
的更多信息
我正在使用 ReactNative Expo 开发 android/iOS 应用程序,还通过 expo ADMOB sdk 添加了 AdMOB。问题是当我使用 expo build:android -t apk
生成 apk 时。由于 app.json
文件中的 googleMobileAdsAppId
字段,它返回以下错误。我正在使用 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.
这是我的 app.json
文件:
{
"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"
}
}
}
}
嗯,解决方案很简单,因为 SDK version: 34.0.0
。我刚刚将当前版本更新为 35.0.0
,它非常有用。
从 SDK 34 升级到 SDK 35:
app.json
,将sdkVersion
改为"35.0.0"
- 在
package.json
中,更改这些依赖项:
{
"react-native": "https://github.com/expo/react-native/archive/sdk-35.0.0.tar.gz",
"expo": "^35.0.0",
"react": "16.8.3"
}
- 删除项目的 node_modules 目录并 运行 npm install 再次
- 还有 运行
expo r -c
和npm cache clean -f
以避免任何缓存问题。
就是这样。
的更多信息