我在Android v4.4.2上编译了react-native,但出现了问题:
我试图遵循此solution,但我不知道如何在命令提示符Windows 10上运行:
$> cd myproject
$> react-native start > /dev/null 2>&1 &
$> curl "http://localhost:8081/index.android.bundle?platform=android" -o
> "android/app/src/main/assets/index.android.bundle
$> (cd android/ && ./gradlew assembleDebug)
我试图在Android V6.0上以相同的方式编译。然后根本没有问题。
如何制作android V4.4.2也可以像Android v6.0一样用于我的第一个本机反应 项目开发?
答案 0 :(得分:4)
该错误意味着您的React Native应用无法从您的localhost获取您的JS文件。您通常只需运行react-native start
来提供打包程序中的JS文件,但Android 4.4.x无法使用默认的adb reverse
方法连接到您的localhost。
我在Android 4.4.x上运行的方式是手动将设备设置为通过Wi-Fi连接到我的机器(Official guide here!)。
答案 1 :(得分:0)
尝试运行此命令
adb reverse tcp:8081 tcp:8081