Home 안드로이드 androidx.core:core-ktx와 androidx.core:core 라이브러리 호환성 이슈
Post
Cancel

안드로이드 androidx.core:core-ktx와 androidx.core:core 라이브러리 호환성 이슈

문제 상황

Retrofit2 라이브러리를 사용하려고 하던 중 아래와 같은 오류 메시지가 발생하며 앱이 빌드되지 않았다

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
2 issues were found when checking AAR metadata:

1.  Dependency 'androidx.core:core-ktx:1.12.0-alpha05' requires libraries and applications that
    depend on it to compile against version 34 or later of the
    Android APIs.

    :app is currently compiled against android-33.

    Also, the maximum recommended compile SDK version for Android Gradle
    plugin 8.0.2 is 33.

    Recommended action: Update this project's version of the Android Gradle
    plugin to one that supports 34, then update this project to use
    compileSdk of at least 34.

    Note that updating a library or application's compileSdk (which
    allows newer APIs to be used) can be done separately from updating
    targetSdk (which opts the app in to new runtime behavior) and
    minSdk (which determines which devices the app can be installed
    on).

2.  Dependency 'androidx.core:core:1.12.0-alpha05' requires libraries and applications that
    depend on it to compile against version 34 or later of the
    Android APIs.

    :app is currently compiled against android-33.

    Also, the maximum recommended compile SDK version for Android Gradle
    plugin 8.0.2 is 33.

    Recommended action: Update this project's version of the Android Gradle
    plugin to one that supports 34, then update this project to use
    compileSdk of at least 34.

    Note that updating a library or application's compileSdk (which
    allows newer APIs to be used) can be done separately from updating
    targetSdk (which opts the app in to new runtime behavior) and
    minSdk (which determines which devices the app can be installed
    on).

해결법

해결법은 생각보다 간단한데 해당 문제는 ‘androidx.core:core-ktx:1.12.0-alpha05’ 라이브러리가 최소한 Android API 버전 34 이상을 필요로 하지만 현재 프로젝트에서 ‘android-33’을 사용하고 있기 때문에 발생한 것이다

그렇기에 버전을 올려주면 간단히 해결된다

This post is licensed under CC BY 4.0 by the author.