[英]react-native build only (android)
Scenario 脚本
I used react-native run-android
to build my android project but it also runs the project. 我使用react-native run-android
构建我的android项目,但它也运行该项目。 Because I'm using an npm plugin to modify my build information I'm only interested in building rather than launching. 因为我使用npm插件来修改我的构建信息,所以我只对构建感兴趣,而不是启动。
Question 题
With react native is it possible to build android files without launching? 使用react native是否可以在不启动的情况下构建android文件? Theoretically something like react-native build-android
or react-native run-android --build-only
从理论上讲,类似react-native build-android
或react-native run-android --build-only
Extra Info 额外信息
I looked into the help
for react-native run-android
but didn't see anything promising. 我调查了react-native run-android
的help
,但没有发现任何希望。
$ react-native run-android --help
Scanning folders for symlinks in /Users/Jackson/Sites/fnmultiapptest/node_modules (11ms)
react-native run-android [options]
builds your app and starts it on a connected Android emulator or device
Options:
--install-debug
--root [string] Override the root directory for the android build (which contains the android directory) (default: "")
--flavor [string] --flavor has been deprecated. Use --variant instead
--variant [string]
--appFolder [string] Specify a different application folder name for the android source. (default: "app")
--appId [string] Specify an applicationId to launch after build. (default: "")
--appIdSuffix [string] Specify an applicationIdSuffix to launch after build. (default: "")
--main-activity [string] Name of the activity to start (default: "MainActivity")
--deviceId [string] builds your app and starts it on a specific device/simulator with the given device id (listed by running "adb devices" on the command line).
--no-packager Do not launch packager while building
--port [number] (default: 8081)
--config [string] Path to the CLI configuration file
-h, --help output usage information
Navigate to the android directory and run ./gradlew assembleDebug
. 导航到android目录并运行./gradlew assembleDebug
。 You can then manually install. 然后,您可以手动安装。
Maybe just with: 也许只是:
cd android && ./gradlew build -x lint
(use gradlew.bat
if you run it on windows) (如果在Windows上运行,请使用gradlew.bat
)
https://github.com/facebook/react-native/blob/master/local-cli/runAndroid/runAndroid.js#L180 https://github.com/facebook/react-native/blob/master/local-cli/runAndroid/runAndroid.js#L180
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.