[Android] Execution failed for task ':app:kaptDebugKotlin'

jeongsik kim·2021년 12월 23일
0

Kotlin DataBinding 테스트 코드 빌드 시 발생

Android12(API 31)로 올라가면서 생긴 문제로 보임

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:kaptDebugKotlin'.
    A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptExecution java.lang.reflect.InvocationTargetException (no error message)
  • 아래와 같이 compileSdkVersion, targetSdkVersion 31 -> 30으로 수정
android {
    compileSdkVersion 30
    .....

    defaultConfig {
    	.....
        targetSdkVersion 30
        .....
    }
}
  • 빌드시 추가로 발생하는 오류는 알아서 수정

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.appcompat:appcompat:1.4.0.
AAR metadata file: /Users/kimjeongsik/.gradle/caches/transforms-2/files-2.1/c3665253cf6b8ee3e36a7af8c8bfcce5/appcompat-1.4.0/META-INF/com/android/build/gradle/aar-metadata.properties.

  • 아래와 같이 수정
dependencies {
    .....
    implementation 'androidx.core:core-ktx:1.6.0'
    implementation 'androidx.appcompat:appcompat:1.3.0'
    .....
}
  • compileSdkVersion, targetSdkVersion 수정에 따른 다른 오류들도 추가로 발생할 것으로 보임
profile
Android=Kotlin, iOS=Swift, CrossPlatform=Flutter

0개의 댓글