I have tried many solutions but all in vain, including this
React Native Android build failure with different errors without any changes in code for past days due to publish of React Native version 0.71.0-rc.0
I am having deadline ahead and my project is not building from last 4 days, any help will be appreciated.
* What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
> The minCompileSdk (31) specified in a
dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
is greater than this module's compileSdkVersion (android-30).
Dependency: androidx.activity:activity-compose:1.4.0.
AAR metadata file: /Users/dev/.gradle/caches/transforms-2/files-2.1/c35837abe789834d04f87678613d3ab9/jetified-activity-compose-1.4.0/META-INF/com/android/build/gradle/aar-metadata.properties.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
I have tried compileSdkVersion = 31
targetSdkVersion = 31
after that I am getting
Execution failed for task ':react-native-incall-manager:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
My build.gradle file is
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
buildToolsVersion = "30.0.2"
minSdkVersion = 21
compileSdkVersion = 31
targetSdkVersion = 31
androidXCore = "1.7.0"
}
repositories {
google()
jcenter()
}
dependencies {
classpath("com.android.tools.build:gradle:4.2.1")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
google()
jcenter()
maven { url 'https://www.jitpack.io' }
}
}
React native version is "^0.66.3"
3
Answers
This is an issue from gradle servers. There are many official fixes being launched. You can either upgrade react-native to 0.70.5 or you can patch it using fix available here. https://github.com/facebook/react-native/issues/35249
Your app was working fine before right so, please follow below steps and check
node_modules
android/build
&android/app/build
)package.json
if thereact-native
version is as which was worked before (in your case0.66.3
)npm install
oryarn
to install packagesandroid/build.gradle
fileRef: Fix and updates on Android build failures happening since Nov 4th 2022 #35210
It is causing due to some issue at react-native since friday, 4 Nov 2022.
Updating your react-native version can solve it.
Note: No need to update gradle files for this issue.
All fix version of RN are mentioned here.
Ex: if you are on 0.64.3, change to 0.64.4
ref: https://github.com/facebook/react-native/issues/35210