Tips to Fix “error Failed to install the app. Make sure you have the Android development environment set up in React Native”

React is a JavaScript open-source library that no programmer is unaware of. It is a front-end language that is easier for all the programmers to code and then compile. React has also given an opportunity to programmers to work on Android system-based projects. When you are working with react android, you can have “error Failed to install the app. Make sure you have the Android development environment set up in React Native”. This is the type of error that shows when you code a program.

The issue seems complicated, but no need to think much as we are here to give you a helping hand and take you out of the error warning that pops up. First, we have to figure out how you can land up in an error message.

How error shows up

It is really important to know how you get the error warning even before going to the solution section. As soon as you create a new project in react native, you test iOS in an Android emulator. But when creating a new project, you will land up in trouble. Like this

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.

Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081

Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01

Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01

Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01

Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01

Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01

FAILURE: Build failed with an exception.

* What went wrong:

Execution failed for task ':app:mergeDebugAssets'.

> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.

   > Could not find com.facebook.yoga:proguard-annotations:1.14.1.

You get the error despite following the below ways

  • react-native init projectName
  • cd projectName
  • react-native run-projectName

How to Solve “error Failed to install the app. Make sure you have the Android development environment set up in React Native”

Check out a few short and effective solutions to fix the error

Uninstall unused react-native video

You can resolve the error by removing the react native video that is not in use. Follow the command below the fix

npm uninstall --save react-native-video

Add ‘Jcenter’

You need to open the build.gradle file, and then go to the Allprojects repository: Add jcenter(). Check out the example below

allprojects {

    repositories {

        mavenCentral()

        mavenLocal()

        jcenter()

}

Clean Cache

In the case, you have an app on your phone, you need to remove it, and then try to run the project again. You should follow the code below to fix the error

cd .\android\ ./gradlew clean

In the root file of the project, use the below code

npx react-native start --reset-cache

Add a short command

A quick and short command can be of great help

npx --quiet react-native config or npx.cmd --quiet react-native config

For Mac

When using mac, you need to follow the command

chmod +x gradlew

For Windows 10

 The below command can solve the error

cd android && chmod +x gradlew

If this command doesn’t work, you need to install Git. Once done, you will find the folder name ‘Git’ in Program Files in your system. Along with finding Git, you need to find ‘usr’ and then ‘bin’. It should look like this

C:\Program Files\Git\usr\bin

Now, you just need to add this path to the path variables in the system environment. Once done, try the command again after restarting.

Conclusion

And that’s how you can fix the “error Failed to install the app. Make sure you have the Android development environment set up in React Native”. Hope you find it helpful!

Reference Source: https://thestye.com/bash/error-failed-to-install-the-app-make-sure-you-have-the-android-development-environment-set-up/

https://www.anycodings.com/1questions/5438539/react-native-error-failed-to-install-the-app-make-sure-you-have-the-android-development-environment-set-up

https://stackoverflow.com/questions/56891033/facing-issue-failed-to-install-the-app-make-sure-you-have-the-android-develop

Leave a Reply

Your email address will not be published. Required fields are marked *