react-native run-android --variant=release does not work currently.
See original GitHub issueDescription
cannot test release variant on android.
Reproduction
in console at root of project run
react-native run-android --variant=release
JS server already running. Running /usr/local/opt/android-sdk/platform-tools/adb -s 192.168.56.101:5555 reverse tcp:8081 tcp:8081 Building and installing the app on the device (cd android && ./gradlew installReleaseDebug)… Incremental java compilation is an incubating feature.
FAILURE: Build failed with an exception.
-
What went wrong: Task ‘installReleaseDebug’ not found in root project ‘mysupercoolapp’.
-
Try: Run gradlew tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Solution
I can get it to work doing cd android && ./gradlew installRelease. Maybe the react-native command needs to be remapped to a different gradle command?
Additional Information
Someone else got this 7 hours ago on SO as well: http://stackoverflow.com/questions/41263330/error-running-react-native-run-android-variant-release-task-installreleasede
- React Native version: 0.39.x
- Platform: Android
- Operating System: MacOS
Issue Analytics
- State:
- Created 7 years ago
- Comments:26 (3 by maintainers)
Top Related StackOverflow Question
Yeah so this was a problem I had. Turns out there was a PR created which changed this but the documentation was also not updated. I’ll try and find the PRs for the change and docs (which hasn’t merged).
For now run:
PR for the change: https://github.com/facebook/react-native/pull/10867#issuecomment-266769510 PR for the docs change: https://github.com/facebook/react-native/pull/11443
So it seems to be because I forgot to include “signingConfig signingConfigs.release” in the “release” property of the “buildTypes” property of the app\build.gradle.