为IOS和Android平台构建React本机代码

问题描述 投票:0回答:1

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

android ios reactjs react-native cross-platform
1个回答
0
投票

在Android和IOS平台上运行App的步骤

1)从存储库签出 2)转到项目目录 3)跑 npm install

4)运行react-native run-android在Android设备react-native run-ios上运行应用程序以在IOS模拟器上运行应用程序

Android特定:

React-Native准备未签名的APK:

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

捆绑调试版本:

跑 :

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

创建调试版本:

cd android

然后

./gradlew assembleDebug

Generated apk将位于android/app/build/outputs/apk

IOS具体

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

运行:react-native bundle --dev false --entry-file index.ios.js --bundle-output ios/main.jsbundle --platform ios

转到qazxsw poi打开Xcode项目文件

转到Xcode中的XCode - > Product,然后根据您想要的版本执行相应步骤

完成!!!

© www.soinside.com 2019 - 2024. All rights reserved.