为IOS和Android平台构建ReactNative代码

时间:2018-01-15 16:40:32

标签: android ios reactjs react-native cross-platform

在IOS和Android平台上构建并运行React-Native Codebase
在IOS和Android平台上运行反应本机代码所需的基本命令是什么

1 个答案:

答案 0 :(得分:0)

在Android和IOS平台上运行应用程序的步骤

1)从存储库签出
2)转到项目目录
3)运行
react-native run-android

4)跑 react-native run-ios在Android设备上运行应用 react-native bundle --dev false --platform android --entry-file index.android.js --bundle-output ./android/app/build/intermediates/assets/debug/index.android.bundle --assets-dest ./android/app/build/intermediates/res/merged/debug在IOS模拟器上运行应用

Android特定:

React-Native准备未签名的APK:

您需要手动为调试版本创建捆绑包。

捆绑调试版本:

运行:

cd android

创建调试版本:

./gradlew assembleDebug

然后

android/app/build/outputs/apk

Generated apk将位于react-native bundle --dev false --entry-file index.ios.js --bundle-output ios/main.jsbundle --platform ios

IOS特定

您需要手动为调试版本创建捆绑包。

运行: XCode

转到Product打开Xcodeproject文件

转到Archive - > Xcode中的CMAKE_OPTIONS,并根据您所需的版本执行步骤

完成!!!