React Native 0.59开发构建因都市服务器错误而失败

时间:2019-03-18 06:14:09

标签: android react-native

升级到0.59后,开发版本将失败,并显示以下错误。直到0.58.6都可以正常工作

“无法加载脚本。请确保您正在运行Metro服务器(运行'react-native start'),或者您的软件包已正确打包以供发布。”

我还在AndroidManifest.xml中添加了read_string,但仍然无法正常工作。该发行版的工作正常。

4 个答案:

答案 0 :(得分:4)

您需要在项目级别build.gradle中将目标sdk更改为 27 ,而不是 28 。从 Android P(28)起,Google禁止使用http。

enter image description here

答案 1 :(得分:0)

I had this same issue using genymotion and then I realized that the emulator was offline, and that's why it couldn't connect to the metro server.

答案 2 :(得分:0)

尝试这个Link,它肯定会工作。

答案 3 :(得分:0)

"react-native": "0.64.1",

我使用了其他解决方案,但我已经通过其他方式解决了这个问题,在 bundleInDebug: true, 中更改了 project.ext.react 中的 android > app > build.gradle

project.ext.react = [
bundleInDebug: true,
enableHermes: ***,  

]

相关问题