Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

react-native run-android fails, could not install app

Tags:

react-native

I m having a problem when I try to run my react-native application in my Android Device. The device is connected even when I make sure that it is.

adb devices

List of devices attached

HMNBBCE6A2826109 device

Device: Huawei Y2 Android Version: 5.1 Debug mode: enbaled the server is running. When i run

react-native run-android

I get this 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/android-setup.html

like image 206
Rafik Avatar asked Dec 06 '22 14:12

Rafik


1 Answers

I had the same problem with my linux laptop. I ran this inside my app root folder and worked:

chmod 755 android/gradlew

You have to give permission on the android/gradlew.

I found the answer on this github issue

And you must also do this:

Click here to see the all article on the react-native docs page (the place where i get this information).

  1. Configure the ANDROID_HOME environment variable
    The React Native tools require some environment variables to be set up in order to build apps with native code.
    Add the following lines to your $HOME/.bash_profile config file:
    export ANDROID_HOME=$HOME/Android/Sdk
    export PATH=$PATH:$ANDROID_HOME/tools
    export PATH=$PATH:$ANDROID_HOME/platform-tools

    .bash_profile is specific to bash. If you're using another shell, you will need to edit the appropriate shell-specific config file.

like image 156
Igor Phelype Guimarães Avatar answered Feb 12 '23 14:02

Igor Phelype Guimarães