如何在物理设备上安装react native android apk

时间:2016-04-26 05:38:04

标签: react-native

我为react本机应用程序生成了签名的apk,现在我想给分发。如何将其他人安装在他们的设备上。它给出了错误java.lang.RuntimeException:ReferenceError:找不到变量:__ fbBatchedBridge(: 1)因为react-native服务器没有启动。第三个人如何安装我的应用程序。

我需要做什么设置才能通过安装apk来安装我的应用程序。

1 个答案:

答案 0 :(得分:1)

1)首先创建捆绑包:

react-native bundle --platform android --dev false --entry-file index.android.js \
  --bundle-output android/app/src/main/assets/index.android.bundle \
  --assets-dest android/app/src/main/res/

2)然后组装发行版以安装到:

cd android && ./gradlew assembleRelease && cd -

3)然后检查该设备是否为唯一连接的设备:

adb devices

4)最后安装发行版:

cd android && ./gradlew installRelease && cd -

步骤#2不是强制性的,但创建发布APK一般都很好。

相关问题