错误:验证 app.json 中的字段时出现问题。请参阅 https://docs.expo.io/workflow/configuration/ • 不应有额外的属性'config'



我正在使用ReactNative Expo开发Android/iOS应用程序,还添加了AdMOB。问题是当我运行 expo build:ios 时,它返回以下错误验证 app.json 中的字段时出现问题。请参阅 https://docs.expo.io/workflow/configuration/• 不应具有其他属性"配置"。

这是我的app.json文件:

{
"expo": {
"name": "AppName",
"slug": "AppSlug",
"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
},
"config": {
"googleMobileAdsAppId": "ca-app-pub-xxxxxx"
},
"android": {
"package": "com.x.yyyyy",
"config": {
"googleMobileAdsAppId": "ca-app-pub-xxxxxx"
}
}
}
}

这只是一个愚蠢的打字错误。您必须将"配置"键放在"ios"中。

这将解决您的问题:

{
"expo": {
"name": "AppName",
"slug": "AppSlug",
"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,
"config": {
"googleMobileAdsAppId": "ca-app-pub-xxxxxx"
}
},
"android": {
"package": "com.x.yyyyy",
"config": {
"googleMobileAdsAppId": "ca-app-pub-xxxxxx"
}
}
}
}

这只是一个愚蠢的错字。

不要在 slug 中有任何空格或下划线。

最新更新