内置的Expo应用程序在启动时崩溃:找不到类“ host.exp.exponent.taskManager.ExpoHeadlessAppLoader”

问题描述

当我尝试通过Expo运行使用React Native构建的应用程序时,它在启动屏幕上崩溃。如果我通过真实设备上的expo应用程序或通过仿真器启动它,它运行得很好。 Logcat给我错误

 W/System.err: Caused by: java.lang.classNotFoundException: Didn't find class "host.exp.exponent.taskManager.ExpoHeadlessAppLoader"

我找不到关于此错误消息的任何信息,但是我似乎已经读到这些类型的问题与package.json文件有关。这是我的样子:

    {
  "main": "node_modules/expo/AppEntry.js","scripts": {
    "start": "expo start","android": "expo start --android","ios": "expo start --ios","web": "expo start --web","eject": "expo eject"
  },"dependencies": {
    "expo": "~38.0.8","expo-constants": "~9.1.1","expo-location": "~8.2.1","expo-status-bar": "^1.0.2","geolib": "^3.3.1","react": "~16.11.0","react-dom": "~16.11.0","react-native": "https://github.com/expo/react-native/archive/sdk-38.0.2.tar.gz","react-native-dialog-input": "^1.0.8","react-native-maps": "0.27.1","react-native-svg": "12.1.0","react-native-web": "~0.11.7","react-native-svg-transformer": "^0.14.3","@react-native-community/slider": "^3.0.3"
  },"devDependencies": {
    "@babel/core": "^7.8.6","babel-preset-expo": "~8.1.0"
  },"expo": {
    "android": {
      "package": "com.atlemlund.naturetracker","config": {
        "googleMaps": {
          "apiKey": "MY API KEY"
        }
      }
    }
  },"private": true
}

解决方法

解决了!原来,该错误消息与崩溃无关。我放错了API密钥。将其从package.json移至app.json解决了我的问题。