创建一个 react-native 项目,使用create-react-native-app
并弹出,无需任何更改。之后,运行该命令会yarn run android
生成一个正确的包并在通过 USB 连接的手机上启动该应用程序。但是,在应用程序崩溃之前,带有消息的红屏会TypeError: undefined is not an object (evaluating '_configProvider.remoteModuleConfig')
出现几秒钟。
cat package.json
{
"name": "rn-expo-app",
"version": "0.1.0",
"private": true,
"devDependencies": {
"jest-expo": "^0.3.0",
"react-test-renderer": "~15.4.1"
},
"scripts": {
"start": "react-native start",
"android": "react-native run-android",
"ios": "react-native run-ios",
"test": "node node_modules/jest/bin/jest.js --watch"
},
"jest": {
"preset": "jest-expo"
},
"dependencies": {
"react": "~15.4.0",
"react-native": "0.42.3"
}
}
尝试使用 Gradle 3.4.1 和 Gradle 2.14.1 运行该命令。
手机是 Google Pixel 7.1.1。还尝试使用 Genymotion,模拟 Nexus 5X 6.0.0(使用模拟器,红屏仍然存在)。
完整的错误信息:
TypeError: undefined is not an object (evaluating '_configProvider.remoteModuleConfig') (http://10.0.3.2:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:3547)
http://10.0.3.2:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:3547:56
get@http://10.0.3.2:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:3934:12
http://10.0.3.2:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:3369:32
loadModuleImplementation@http://10.0.3.2:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:127:8
guardedLoadModule@http://10.0.3.2:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:70:32
_require@http://10.0.3.2:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:54:18
http://10.0.3.2:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:27365:26
loadModuleImplementation@http://10.0.3.2:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:127:8
guardedLoadModule@http://10.0.3.2:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:70:32
_require@http://10.0.3.2:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:54:18
setUpDevTools@http://10.0.3.2:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:22968:26
http://10.0.3.2:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:22997:14
loadModuleImplementation@http://10.0.3.2:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:127:8
guardedLoadModule@http://10.0.3.2:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:63:37
_require@http://10.0.3.2:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:54:18
global code@http://10.0.3.2:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:85271:9