Expo eas build apk 在真实设备上崩溃,但在 expo go 上工作

Zak*_*dil 5 sdk android react-native expo

在开发环境中使用模拟器进行测试时,一切都运行正常,但是当我构建我的 expo 应用程序以使用此命令获取 apk 时eas build -p android --profile preview。当我在真实设备上安装该 apk 后,它立即崩溃。但如果我在 expo go 上运行它,它会正常运行。

这是我的 package.json

{
  "name": "myapp",
  "version": "1.0.0",
  "main": "node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "web": "expo start --web"
  },
  "dependencies": {
    "@react-native-firebase/app": "^16.4.6",
    "@react-native-firebase/messaging": "^16.4.6",
    "@react-native-picker/picker": "^2.4.8",
    "@react-navigation/drawer": "^6.5.3",
    "@react-navigation/native": "^6.0.16",
    "@react-navigation/stack": "^6.3.7",
    "@reduxjs/toolkit": "^1.9.1",
    "email-validator": "^2.0.4",
    "expo": "~47.0.8",
    "expo-dev-client": "~2.0.1",
    "expo-device": "~5.0.0",
    "expo-image-picker": "~14.0.2",
    "expo-notifications": "~0.17.0",
    "expo-status-bar": "~1.4.2",
    "expo-updates": "~0.15.6",
    "firebase": "^9.6.7",
    "formik": "^2.2.9",
    "react": "18.1.0",
    "react-native": "0.70.5",
    "react-native-gesture-handler": "~2.8.0",
    "react-native-modal-datetime-picker": "^14.0.0",
    "react-native-reanimated": "^2.12.0",
    "react-native-safe-area-context": "^4.4.1",
    "react-native-screens": "~3.18.0",
    "react-native-toast-message": "^2.1.5",
    "react-redux": "^8.0.5",
    "redux": "^4.2.0",
    "redux-thunk": "^2.4.2",
    "yup": "^0.32.11"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9"
  },
  "private": true
}
Run Code Online (Sandbox Code Playgroud)

这是我的 eas.json

{
  "cli": {
    "version": ">= 2.6.0"
  },
  "build": {
    "development": {
      "developmentClient": true,
      "distribution": "internal"
    },
    "preview": {
      "distribution": "internal",
      "android": {
        "buildType": "apk"
      }
    },
    "preview2": {
      "android": {
        "gradleCommand": ":app:assembleRelease"
      }
    },
    "production": {}
  },
  "submit": {
    "production": {}
  }
}
Run Code Online (Sandbox Code Playgroud)

小智 0

我遇到了像你一样的问题,你遇到这样的问题的主要原因是你安装了库,而不是与expo一起工作,只能与react-native一起使用,检查你的依赖关系,我想它会起作用