React Native 错误:验证app.json中的字段时出现问题,请参阅https://docs.expo.io/workflow/configuration/·不应具有其他属性'config'

1tuwyuhd  于 2023-01-31  发布在  React
关注(0)|答案(2)|浏览(142)

我正在使用ReactNative Expo开发android/iOS应用程序,还添加了AdMOB。问题是当我运行expo build:ios时,它返回以下错误验证app.json中的字段时出现问题。请参阅https://docs.expo.io/workflow/configuration/·不应具有其他属性“config”。
下面是我的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"
      }
    }
  }
}
vbopmzt1

vbopmzt11#

这只是一个愚蠢的打字错误。你必须把"config"键放在"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"
      }
    }
  }
}

只是个愚蠢的打字错误。

bnlyeluc

bnlyeluc2#

不要使用任何空格或下划线。

相关问题