React Native 清单(app.json)未初始化|世博会

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

我正在尝试实现一个聊天应用程序的世博会推送通知,所以通过以下文档,我达到了我需要运行以下命令的部分:expo push:android:upload --api-key your-token-here。所以我从firebase那里得到了令牌,在运行命令后,我得到了一个错误消息Manifest (app.json) not initialized。我猜这个问题是因为我使用了动态配置(app.config.js)。我该如何修复它呢?
app.config.js

import "dotenv/config";

export default {
  expo: {
    name: "XXX",
    slug: "XXX",
    version: "1.0.0",
    scheme: "com.XXXXXXXXX.XXXX",
    orientation: "portrait",
    icon: "./assets/icon.png",
    userInterfaceStyle: "light",
    splash: {
      image: "./assets/splash.png",
      resizeMode: "contain",
      backgroundColor: "#ffffff",
    },
    updates: {
      fallbackToCacheTimeout: 0,
    },
    assetBundlePatterns: ["**/*"],
    ios: {
      supportsTablet: true,
    },
    android: {
      package: "com.XXXXXXXXX.XXXX",
      googleServicesFile: "./google-services.json",
      adaptiveIcon: {
        foregroundImage: "./assets/adaptive-icon.png",
        backgroundColor: "#FFFFFF",
      },
    },
    web: {
      favicon: "./assets/favicon.png",
    },
    extra: {
      apiKey: process.env.API_KEY,
      authDomain: process.env.AUTH_DOMAIN,
      projectId: process.env.PROJECT_ID,
      storageBucket: process.env.STORAGE_BUCKET,
      messagingSenderId: process.env.MESSAGING_SENDER_ID,
      appId: process.env.APP_ID,
      measurementId: process.env.MEASUREMENT_ID,
      oneSignalAppId: process.env.ONESIGNAL_APP_ID,
    },
    plugins: [
      [
        "expo-image-picker",
        {
          photosPermission:
            "The app accesses your photos to let you share them with your friends.",
        },
      ],
    ],
  },
};
arknldoa

arknldoa1#

我想知道你是否使用了动态配置之前,这个变化?这是很难说,但通过快速浏览您张贴的配置,我相信你不期望有expo键在动态配置。
看看config docs,静态配置确实具有expo的结构:

// app.json content
{
  "expo": {
    "name": "My app",
    "slug": "my-app"
  }
}

但是当你看动态的时候,所有的东西都被放平了:

// app.config.js content
module.exports = {
  "name": "My app",
  "slug": "my-app"
};

如果没有帮助,我建议运行expo config来查看Expo看到的内省结果配置。

相关问题