Guys please help me i can't build or upgrade anything in flutter and i get alot of errors like that FAILURE: Build failed with an exception.
- What went wrong: Execution failed for task ':app:checkReleaseAarMetadata'.
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-30). Dependency: androidx.window:window-java:1.0.0-beta04. AAR metadata file: C:\Users\Carnival.gradle\caches\transforms-2\files-2.1\625039eaad011f884ddd84f857a44b7f\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-30). Dependency: androidx.window:window:1.0.0-beta04. AAR metadata file: C:\Users\Carnival.gradle\caches\transforms-2\files-2.1\a78fdf90e4c1f8464b19895cfb365f3f\jetified-window-1.0.0-beta04\META-INF\com\android\build\gradle\aar-m etadata.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.
Get more help at https://help.gradle.org
CodePudding user response:
change the compileSdkVersion and targetSdkVersion in build.gradle file.
(YourAppName\android\build.gradle).
compileSdkVersion from 29 to 30
targetSdkVersion from 29 to 30
If you're already in version 30 then check yourappname/android/build.gradle has these repositories or not
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}allprojects {
repositories {
google()
jcenter()
}}rootProject.buildDir = '../build'subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
project.evaluationDependsOn(':app')}task clean(type: Delete) {
delete rootProject.buildDir}
This above code is not beautiful as StackOverflow is not able to take build.gradle file
CodePudding user response:
30 might also fail so just bump it up to 31 also, the ext.kotlin_version might also cause problems after the above change and will need the latest version which is 1.6.10. However, implement the changes as necessary. If changing the SdkVersion alone solves your problem, call it a win.
