Search code examples
android-emulatorreact-nativereact-native-cli

React-Native-CLI & Android :Failed to start the app. Make sure you have the Android development environment set up


I can't run an existing react-native-cli app into my android device. Similar thing happened for iOS emulator, but I'm managed to solve it. So now I can only run into iOS not android. Please take a look at the error message and tell me what to do.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:installDebug'.
> com.android.builder.testing.api.DeviceException: com.android.ddmlib.InstallException: INSTALL_FAILED_UPDATE_INCOMPATIBLE: Package com.banana.apple 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 9s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
Unable to install C:\Users\Admin\Desktop\Materials\Source Code\PunreachAPP\android\app\build\outputs\apk\debug\app-debug.apk

Solution

  • You must have installed the app previously ( possibly from the play store ) with a different version code and version name. So in order to build and run the app, you need to uninstall the previously installed app with package id

    com.banana.apple

    You can do this in 2 ways:

    1. Manually uninstalling just like any other app from your device
    2. Run the following command when connecting your phone via USB (source).

    adb uninstall "com.banana.apple"