使用create-react-native-app
创建一个react-native项目,并在不做任何更改的情况下弹出。之后,运行命令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