Abstract.
기존에 안드로이드 스튜디오를 Dolphin 버전을 사용했었는데 Eel 버전으로 업데이트 하면서 문제가 생겼다. 기존에 사용하던 Dolphin 버전에서 새 프로젝트를 작성하면 build.gradle에서 compileSdk 32 / targetSdk 32로 셋팅하여 사용했는데, 별 문제 없이 빌드되던 것이 Eel 버전으로 업데이트 후 빌드 에러가 발생했다. 결론적으로, 안드로이드 스튜디오를 업데이트 하면서 사용하게 된 것으로 추정되는 build.gradle(Module :app)에 포함된 라이브러리들이 빌드 시 에러를 발생하게 만들었다.
1. 에러 내용
안드로이드 스튜디오 Eel 버전으로 업데이트 하고 Sdk 32로 셋팅된 프로젝트를 실행했더니 다음과 같은 에러가 발생했다. Execution failed for task ':app:checkDebugAarMetadata'. 라는 내용의 에러인데 총 6가지 부문에서 문제가 생겼다.
가장 먼저 확인해 볼 내용은 다음과 같다.
- > Task :app:checkDebugAarMetadata FAILED
Execution failed for task ':app:checkDebugAarMetadata'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
> 6 issues were found when checking AAR metadata:
여기서 AAR metadata를 체크하는 동안 6개의 이슈가 발견되었다고 나오는데 6가지 이슈의 전체 내용은 다음과 같다.
- Dependency 'androidx.appcompat:appcompat-resources:1.6.1' requires libraries and applications that depend on it to compile against version 33 or later of the Android APIs.
:app is currently compiled against android-32.
Recommended action: Update this project to use a newer compileSdkVersion of at least 33, for example 33.
Note that updating a library or application's compileSdkVersion (which allows newer APIs to be used) can be done separately from updating targetSdkVersion (which opts the app in to new runtime behavior) and minSdkVersion (which determines which devices the app can be installed on). - Dependency 'androidx.appcompat:appcompat:1.6.1' requires libraries and applications that depend on it to compile against version 33 or later of the Android APIs.
:app is currently compiled against android-32.
Recommended action: Update this project to use a newer compileSdkVersion of at least 33, for example 33.
Note that updating a library or application's compileSdkVersion (which allows newer APIs to be used) can be done separately from updating targetSdkVersion (which opts the app in to new runtime behavior) and minSdkVersion (which determines which devices the app can be installed on). - Dependency 'androidx.activity:activity:1.6.0' requires libraries and applications that depend on it to compile against version 33 or later of the Android APIs.
:app is currently compiled against android-32.
Recommended action: Update this project to use a newer compileSdkVersion of at least 33, for example 33.
Note that updating a library or application's compileSdkVersion (which allows newer APIs to be used) can be done separately from updating targetSdkVersion (which opts the app in to new runtime behavior) and minSdkVersion (which determines which devices the app can be installed on). - Dependency 'androidx.core:core-ktx:1.9.0' requires libraries and applications that depend on it to compile against version 33 or later of the Android APIs.
:app is currently compiled against android-32.
Recommended action: Update this project to use a newer compileSdkVersion of at least 33, for example 33.
Note that updating a library or application's compileSdkVersion (which allows newer APIs to be used) can be done separately from updating targetSdkVersion (which opts the app in to new runtime behavior) and minSdkVersion (which determines which devices the app can be installed on). - Dependency 'androidx.core:core:1.9.0' requires libraries and applications that depend on it to compile against version 33 or later of the Android APIs.
:app is currently compiled against android-32.
Recommended action: Update this project to use a newer compileSdkVersion of at least 33, for example 33.
Note that updating a library or application's compileSdkVersion (which allows newer APIs to be used) can be done separately from updating targetSdkVersion (which opts the app in to new runtime behavior) and minSdkVersion (which determines which devices the app can be installed on). - Dependency 'androidx.annotation:annotation-experimental:1.3.0' requires libraries and applications that depend on it to compile against version 33 or later of the Android APIs.
:app is currently compiled against android-32.
Recommended action: Update this project to use a newer compileSdkVersion of at least 33, for example 33.
Note that updating a library or application's compileSdkVersion (which allows newer APIs to be used) can be done separately from updating targetSdkVersion (which opts the app in to new runtime behavior) and minSdkVersion (which determines which devices the app can be installed on).
2. 에러 해결
위의 6가지 이슈에서 해결 방법을 바로 확인 가능하다. 하나같이 compileSdkVersion을 최소 33 이상으로 하여 빌드를 진행하라는 것이다. build.gradle(Module :app) 파일을 열어 확인해보면 다음과 같이 compileSdk 32 / targetSke 32로 셋팅이 되어 있다. compileSdk와 targetSdk의 버전만 같으면 정상 작동되는 것으로 생각하기 쉬운데, 에러의 원인은 6가지 이슈에서 확인이 가능하다.
에러 내용에 적힌 설명에 따르면, 다음의 6가지 라이브러리가 최소 compileSdk 33 이상에서 사용 가능한 라이브러리이기 때문에 compileSdk와 targetSdk를 33 버전으로 수정하여 빌드하면 해결 가능하다.
- 'androidx.appcompat:appcompat-resources:1.6.1'
- 'androidx.appcompat:appcompat:1.6.1'
- 'androidx.activity:activity:1.6.0'
- 'androidx.core:core-ktx:1.9.0'
- 'androidx.core:core:1.9.0'
- 'androidx.annotation:annotation-experimental:1.3.0'
첫 프로젝트를 생성하여 빌드에서부터 에러가 발생한다면 대부분 compileSdk와 targetSdk에서 문제가 발생하기 때문에 당황하지 말고 에러 내용을 확인하고 조치하면 된다.
댓글