Flutter

[Flutter] 플루터 앱 실행 오류 (The The minCompileSdk (31) specified in a dependency's AAR metadata ...)

JongHyun99 2022. 3. 16. 22:13
728x90

 

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-30).
        Dependency: androidx.window:window-java:1.0.0-beta04.
        AAR metadata file: C:\Users\tjwhd\.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\tjwhd\.gradle\caches\transforms-2\files-2.1\a78fdf90e4c1f8464b19895cfb365f3f\jetified-window-1.0.0-beta04\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.

* Get more help at https://help.gradle.org

BUILD FAILED in 11s
Exception: Gradle task assembleDebug failed with exit code 1

 

 

스터디로 받은 플루터 과제 소스의 실행환경을 열려니까 위와 같은 오류가 발생했다.

 

구글링 해보니까 build.gradle의 android version이 일치하지 않아서 생긴 문제라고함

 

android {
    compileSdkVersion 30
    ... 중략
    }

 

defaultConfig {
    ...
    targetSdkVersion 30
    ...
}

android\app\build.gradle 경로의 sdkversion을 31로 바꿔주었다

 

compileSdkVersion 30-> compileSdk 31

targetSdkVersion 30 -> targetSdk 31

 

그러더니 다른 문제가 발생했다.

 

 

[!] Your project requires a newer version of the Kotlin Gradle plugin.                       │
│ Find the latest version on https://kotlinlang.org/docs/gradle.html#plugin-and-versions, then │
│ update C:\Users\tjwhd\git\TIL\Flutter\Xylophone_flutter_flearner\android\build.gradle:       │
│ ext.kotlin_version = '<latest-version>'

 

이것은 코틀린 그래들 버전이 일치하지 않아서 발생한 오류.

android\build.gradle의 버전을 바꾸어주니 해결

ext.kotlin_version = '1.3.50' -> '1.6.10'