场景
我使用react-native run-android来构建我的安卓项目,但它也运行这个项目。因为我使用npm插件来修改我的构建信息,所以我只对构建而不是启动感兴趣。
问题
有了react本机,可以在不启动的情况下构建android文件吗?理论上类似于react-native build-android或react-native run-android --build-only
额外信息
我查看了help for react-native run-android,但没有看到任何有希望的地方。
$ 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发布于 2018-10-19 16:58:32
导航到android目录并运行./gradlew assembleDebug。然后可以手动安装。
发布于 2018-10-19 16:53:14
也许只有:
cd android && ./gradlew build -x lint (如果在windows上运行gradlew.bat )
https://github.com/facebook/react-native/blob/master/local-cli/runAndroid/runAndroid.js#L180
https://stackoverflow.com/questions/52895736
复制相似问题