. Advertisement .
..3..
. Advertisement .
..4..
The error: “error Failed to install the app. Make sure you have the Android development environment set up in React Native” is a common error that can show up in many ways. In this blog, we will go through some of the ways you can fix this issue. Read on.
Why dose this error appear?
You just finished testing your React Native iOS app in an Android emulator when creating a new project in react-native but you can not run a new project. Although you follow these ways:
react-native init projectName
cd projectName
react-native run-projectName
But you might get the error below in your terminal.
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.
How To Solve The Error: “error Failed to install the app. Make sure you have the Android development environment set up in React Native”?
Option 1: Include jcenter()
1. Simply open the build.gradle file.
2. In the repositories of allprojects, include jcenter()
3. Here’s an instance.
allprojects {
repositories {
mavenCentral()
mavenLocal()
jcenter()
}
Option 2: Remove react-native-video
If react-native-video is not in use, simply uninstall it utilizing this command line.
npm uninstall --save react-native-video
Option 3: Run the project
Need to check the app does not exist on your phone, if so, you have to delete it
Then, run your project again
cd .\android\
./gradlew clean
In the root of the project:
npx react-native start --reset-cache
Option 4: Add this command
Copy this code and it help you a lot
npx --quiet react-native config or npx.cmd --quiet react-native config
Option 5: For the Windows 10
Firstly, download & install git
-
Find the
C
drive in folder ofProgram Files
, -> findusr
thenbin
in the folderGit.
-
The location for bin folder can be:
C:\Program Files\Git\usr\bin
-
Add this location
C:\Program Files\Git\usr\bin
to path variables, in system environment variables. -
Start cmd again with the follow command:
cd android && chmod +x gradlew/* Your code... */
Conclusion
We hope you enjoyed our article about the error. With this knowledge, we know that you can fix your error: “error Failed to install the app. Make sure you have the Android development environment set up in React Native” quickly by following these steps! If you still have any other questions about fixing this syntax error, please leave a comment below. Thank you for reading!
Leave a comment