16

Whle running my react native code 'react-native run-android' getting below error . It was working proper . But after taking fresh pull from git and npm ci and after I am running then getting this 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
   > The minCompileSdk (30) specified in a
     dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
     is greater than this module's compileSdkVersion (android-29).
     Dependency: androidx.core:core:1.7.0-alpha01.
     AAR metadata file: C:\Users\gauraab\.gradle\caches\transforms-2\files-2.1\9e02d64f5889006a671d0a7165c73e72\core-1.7.0-alpha01\META-INF\com\android\build\gradle\aar-metadata.properties.
9
  • 3
    just got same problem :v – Akza 12 hours ago
  • 1
    Same problem here as well from today. I tried deleting the gradle build cache which didn't solve the issue – ChandrasekarG 11 hours ago
  • 2
    yes, same problem, can anyone know the solution please? – Eniya Sri 11 hours ago
  • 2
    Same problem here just got it today – Asadullah Ali 11 hours ago
  • 2
    @UsamaAltaf where is the core lib defined? I couldn't found androidx.core:core:1.7.0-alpha01 in my project – Akza 11 hours ago
5

I got same issue. Just today. When I try to run locally, I got the exact same error. To get it run again, I update the field compileSdkVersion and targetSdkVersion in file android > build.gradle from 29 to 30. Then, it can run again. If this answer fits with you, you can go with this way. But, personally, I'm lookin for solution without to change the value compileSdkVersion and targetSdkVersion

Update: just change the compileSdkVersion

2
  • compileSdkVersion=29 to compileSdkVersion=30 – Abhigyan Gaurav 11 hours ago
  • 0.64.5 will have all sdk versions updated to 30, so you can use ReactNative upgrade tool and upgrade them all upfront to 30. – Victor Sheyanov 10 hours ago
2

Apparently they just broke this today.

You can fix it by adding the following line to build.gradle file:

configurations.all {   
    resolutionStrategy { force 'androidx.core:core-ktx:1.6.0 }
} 

Finally, the Gradle build was successfully completed. Ref. https://docs.gradle.org/current/dsl/org.gradle.api.artifacts.ResolutionStrategy.html

1

The issue was just what I guessed. So, some updates to a minor version/patch version of an android dependency caused all this today.

To solve this, for the dependencies in your build.gradle file, if you have specified it to take the latest minor/patch version every time you build it, make it take an exact stable version.

For example, my appcompact dependecy was,

implementation "androidx.appcompat:appcompat:1.+

This means that it can update to 1.2.x or 1.3.x etc.. as and when such version updates get published. I changed this to depend on an exact stable version like below,

implementation "androidx.appcompat:appcompat:1.3.0"

Hopefully, this solves the issue for everyone.

enter image description here

7
  • do you know which dependency it is? Caused I already specified with implementation 'androidx.appcompat:appcompat:1.1.0-rc01'. But still got the same error – Akza 11 hours ago
  • Probably the rc build could have caused this. And in general rc builds are quite buggy. Can you try a stable build? – ChandrasekarG 11 hours ago
  • 1
    did you use implementation "com.facebook.react:react-native:+"? Did you specified it, the version? – Akza 11 hours ago
  • I don't use react-native. Mine is a native android project. So, you don't have to change it I believe since that did not break things for me. – ChandrasekarG 11 hours ago
  • I've try to change from androidx.appcompat:appcompat:1.1.0-rc01 to androidx.appcompat:appcompat:1.3.0 (like you did). But, still got the error – Akza 11 hours ago
1

For me the issue is caused by react-native-netinfo 's old version 4.0.0 which was configured to automatically pick up the latest published package of androidx.core... So in that case it did I realized androidx.core.core-1.7.0-alpha01 had been published right as the issue started occurring.

So to fix that I updated my react-native-netinfo package from 4.0.0 to 6.0.0 and this issue was resolved for me.

1
0

I just change compileSdkVersion=29 to compileSdkVersion=30 and my issue solved . Its working

-4

I already changed compileSdkVersion to 30 and it's working

New contributor
Tan Nguyen is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.