Hello Guys, How are you all? Hope You all Are Fine. Today when I am trying to run my app on android it gives me the following Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081 in React Native. So Here I am Explain to you all the possible solutions here.
Without Wasting your time, Lets start This Article to Solve This Error.
- How This Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081 Occurs ?
- How To Solve Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081 ?
- Solution 1: change the
compileSdkVersion
- Solution 2: add ResolutionStrategy
- Solution 3: add 1.7.0-alpha01
- Summery
How This Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081 Occurs ?
I am trying to run my app in android by react-native run-android
this command and I am getting below error:
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.bat app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
How To Solve Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081 ?
- How To Solve Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081 ?
To Solve the error Failed to install the app. Make sure you have the Android development environment set up just change the
compileSdkVersion
in your build.gradle file. Open android > build.gradle file. Change compileSdkVersion from 29 to 30. Change targetSdkVersion from 29 to 30. now run again. - Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
To Solve the error Failed to install the app. Make sure you have the Android development environment set up just change the
compileSdkVersion
in your build.gradle file. Open android > build.gradle file. Change compileSdkVersion from 29 to 30. Change targetSdkVersion from 29 to 30. now run again.
Solution 1: change the compileSdkVersion
To solve this issue just change the compileSdkVersion
in your build.gradle file.
- Open android > build.gradle file.
- Change
compileSdkVersion
from 29 to 30. - Change
from 29 to 30.targetSdkVersion
- now run again.
Solution 2: add ResolutionStrategy
add ResolutionStrategy in your build.gradle file to resolve this issue. here is example. add this following line to build.gradle file:
configurations.all {
resolutionStrategy { force 'androidx.core:core-ktx:1.6.0 }
}
Solution 3: add 1.7.0-alpha01
add the below code in build.gradle
inside android
.
configurations.all {
resolutionStrategy {
force 'androidx.core:core-ktx:1.6.0'
}
}
and then apply this
implementation 'androidx.core:core-ktx:1.7.0-alpha01'
Summery
It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?
Also Read
Solveddddd Thanksss
It’s my Pleasure to Help You Charde. Thank You For Your Valuable words.