본문 바로가기
IT/ERROR

Android MaterialCalendarView 사용 시 'android.useAndroidX=true' 에러 대응

by TechTonic 2022. 10. 28.
반응형

안드로이드에서 캘린더를 사용하기 위해 MaterialCalendarView SDK를 추가하면서 발생할 수 있는 특정 오류와 그 해결 방법에 대해 이야기해보려 합니다.

우선, 제가 캘린더를 사용하기 위해 MaterialCalendarView SDK를 프로젝트에 추가하였습니다.

implementation 'com.prolificinteractive:material-calendarview:1.4.3' 

그런데 gradle build를 진행하는 과정에서 다음과 같은 오류 메시지가 발생하였습니다.

Your project has set `android.useAndroidX=true`, but configuration `:app:debugRuntimeClasspath` still contains legacy support libraries, which may cause runtime issues.
This behavior will not be allowed in Android Gradle plugin 8.0.
Please use only AndroidX dependencies or set `android.enableJetifier=true` in the `gradle.properties` file to migrate your project to AndroidX (see https://developer.android.com/jetpack/androidx/migrate for more info).
The following legacy support libraries are detected:
:app:debugRuntimeClasspath -> com.prolificinteractive:material-calendarview:1.4.3 -> com.android.support:support-v4:25.1.1
:app:debugRuntimeClasspath -> com.prolificinteractive:material-calendarview:1.4.3 -> com.android.support:support-v4:25.1.1 -> com.android.support:support-compat:25.1.1
:app:debugRuntimeClasspath -> com.prolificinteractive:material-calendarview:1.4.3 -> com.android.support:support-v4:25.1.1 -> com.android.support:support-media-compat:25.1.1 -> com.android.support:support-annotations:25.1.1
:app:debugRuntimeClasspath -> com.prolificinteractive:material-calendarview:1.4.3 -> com.android.support:support-v4:25.1.1 -> com.android.support:support-media-compat:25.1.1
:app:debugRuntimeClasspath -> com.prolificinteractive:material-calendarview:1.4.3 -> com.android.support:support-v4:25.1.1 -> com.android.support:support-core-utils:25.1.1
:app:debugRuntimeClasspath -> com.prolificinteractive:material-calendarview:1.4.3 -> com.android.support:support-v4:25.1.1 -> com.android.support:support-core-ui:25.1.1
:app:debugRuntimeClasspath -> com.prolificinteractive:material-calendarview:1.4.3 -> com.android.support:support-v4:25.1.1 -> com.android.support:support-fragment:25.1.1
Enable AndroidX in project's Gradle properties
Open Gradle properties file
More information about migrating to AndroidX...
Affected Modules: app

 

 

이 오류 메시지를 간단히 번역하면 다음과 같습니다:

프로젝트에서 `android.useAndroidX=true`로 설정했지만 `:app:debugRuntimeClasspath` 구성에 여전히 레거시 지원 라이브러리가 포함되어 있어 런타임 문제가 발생할 수 있습니다. 이 동작은 Android Gradle 플러그인 8.0에서 허용되지 않습니다.

이 메시지에서 제공하는 해결책은 gradle.properties 파일에 android.enableJetifier=true 를 추가하는 것입니다. 그렇게 함으로써 프로젝트가 AndroidX로 자동 마이그레이션됩니다.

따라서, gradle.properties 파일을 다음과 같이 수정했습니다:

# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
android.enableJetifier=true
# Enables namespacing of each library's R class so that its R class includes only the
# resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true

 

 

반응형

댓글