Reputation: 32217
Scenario
I used react-native run-android
to build my android project but it also runs the project. Because I'm using an npm plugin to modify my build information I'm only interested in building rather than launching.
Question
With react native is it possible to build android files without launching? Theoretically something like react-native build-android
or 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
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
Upvotes: 2
Views: 3558
Reputation: 2599
Navigate to the android directory and run ./gradlew assembleDebug
. You can then manually install.
Upvotes: 3
Reputation: 3475
Maybe just with:
cd android && ./gradlew build -x lint
(use gradlew.bat
if you run it on windows)
https://github.com/facebook/react-native/blob/master/local-cli/runAndroid/runAndroid.js#L180
Upvotes: 3