'I am facing an error after changing the min sdk version from flutter,minsdk version to a numerical value ie. 16

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':app:checkDebugAarMetadata'.

Multiple task action failures occurred: 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-16). Dependency: androidx.window:window-java:1.0.0-beta04. AAR metadata file: C:\Users\smjro.gradle\caches\transforms-2\files-2.1\ad201fac15a88598107ec645f351f5b4\jetified-window-java-1.0.0-beta04\META-INF\com\android\build\gradle\aar-metadata.properties. 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-16). Dependency: androidx.window:window:1.0.0-beta04. AAR metadata file: C:\Users\smjro.gradle\caches\transforms-2\files-2.1\03c633e46d75bfb21f082f0417f55161\jetified-window-1.0.0-beta04\META-INF\com\android\build\gradle\aar-metadata.properties.



Solution 1:[1]

Set both compileSdkVersion and targetSdkVersion to 31 in your build.gradle(app) file.

android {
    compileSdkVersion 31 // <-- This
    defaultConfig {
        applicationId "com.example.app"
        targetSdkVersion 31 // <-- and this too
        // ...
    }
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Md. Kamrul Amin