0

I'm trying to build an android project and am facing a seemingly well-tread error:

How can I resolve the error "The minCompileSdk (31) specified in a dependency's AAR metadata" in native Java or Kotlin? Android app won't build -- The minCompileSdk (31) specified in a dependency's androidx.work:work-runtime:2.7.0-beta01 How to solve: The minCompileSdk (31) specified in a dependency's AAR metadata I am facing an minCompileSDK issue while developing an android app using android studio

HOWEVER, when I attempted the fix detailed in the answers here, I received the same error, but with a discrepancy between the error message and my actual build.gradle file.

I receive this error here:

Execution failed for task ':app:checkDebugAarMetadata'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
   > The minCompileSdk (34) specified in a
     dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
     is greater than this module's compileSdkVersion (android-33).
     Dependency: androidx.browser:browser:1.6.0.
     AAR metadata file: /Users/ford/.gradle/caches/transforms-3/8660b48b404824c85f1bb716802dc500/transformed/browser-1.6.0/META-INF/com/android/build/gradle/aar-metadata.properties.

As you can see, it says that my minCompileSdk is 34, while the compileSdkVersion is 33. However, in my build.gradle (inside the app folder) is correctly configured:


android {
    ndkVersion rootProject.ext.ndkVersion

    compileSdkVersion 33

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    defaultConfig {
        minSdkVersion 21
        targetSdkVersion 33
        versionName "1.1.52"
    }
}

I've declared the minSdkVersion to be 21, which should satisfy the error message, but the error message says it's 34. This is the only reference to minSdkVersion in my entire codebase. I've tried cleaning, rebuilding, deleting the build folder and rebuilding (which produces another error, can provide details if that's relevant). I've messed around with other values (one answer suggested increasing the minSdkVersion to something higher like 31), and this error message is wrong repeatedly.

Any idea what is wrong here?

fordat
  • 355
  • 4
  • 13
  • 1
    Could be one of your dependencies - check the build.gradle files in your node_modules – Abe Aug 11 '23 at 00:34

1 Answers1

1

androidx.browser:browser:1.6.0 that library only works for sdk 34. You either need to upgrade your compileSdkVersion to 34, or downgrade the library version to 1.5.x

Gabe Sechan
  • 90,003
  • 9
  • 87
  • 127
  • This resolved my errors. For future users, the way to downgrade this particular androidX browser package is detailed here: https://github.com/proyecto26/react-native-inappbrowser/issues/327 – fordat Aug 11 '23 at 16:24