'Execution failed for task ':app:installRelease' react-native
I wanted to create an android apk file in react-native. I followed the instructions as per the link below
https://reactnative.dev/docs/signed-apk-android
- Generated upload key
- Added gradle variables
- Added signing config
this worked well but for below command I am getting an error
npx react-native run-android --variant=release
Error:
Task :app:installRelease FAILED
FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':app:installRelease'.
com.android.builder.testing.api.DeviceException: com.android.ddmlib.InstallException: INSTALL_FAILED_UPDATE_INCOMPATIBLE: Package io.nativebase.market.geekyants.straptaxiapp signatures do not match previously installed version; ignoring!
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 20s 65 actionable tasks: 2 executed, 63 up-to-date error Could not install the app on the device, read the error above for details. Make sure you have an Android emulator running or a device connected and have set up your Android development environment: https://facebook.github.io/react-native/docs/getting-started.html error Command failed: ./gradlew app:installRelease. Run CLI with --verbose flag for more details.strong text
Please help..!
Solution 1:[1]
I had the same problem before. Check that you don't have any other version of the app installed in your phone. If this is the case, uninstall the previous version and it will work fine.
If that does not work, try updating the version number in the app/build.gradle in the android folder.
I hope it helps.
Solution 2:[2]
If you are running react-native run-android --variant=release to build an apk we usually get such error but that's fine as the error is only because we aren't running an emulator or a real device.
Hence it says that the error is because it is unable to install it as there are no active devices.
I found this error today and everything is fine.
Solution 3:[3]
I know this question already has an accepted answer, but I ran into this as well. I had to make sure to terminate any running instances of the app on the simulator, device, and terminate Metro. Then this error went away.
Solution 4:[4]
Just to add: In my case with respect to @mediaguru's answer - It worked fine on my end just mere uninstalling the installed app in the device (metro was not terminated - because I was in haste to apply the answer, and did not care to read further down to @mediaguru's addition not until mine was solved).
Solution 5:[5]
My gradle.properties
had unsupported parameter, i.e., -XX:MaxPermSize=512m
. Changing this line of code, from:
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
to
org.gradle.jvmargs=-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
fixed the problem.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | MIPB |
Solution 2 | Abhilash Purohit |
Solution 3 | mediaguru |
Solution 4 | Narendra_Nath |
Solution 5 | Daniel Danielecki |