홈 > 프로그래밍 > 안드로이드
안드로이드

All com.android.support libraries must use the exact same version spec…

드리에이터 0 5724

안드로이드 스튜디오에서 최신 sdk를 쓰지 않는다고 워닝?이 발생해서

compileSdkversion과 targetSdkVersion을 27에서 28(Android 9.0)로 변경했습니다.

(새로운 OS가 출시되면 발생하는 현상)


그런데 아래의 에러가 발생하네요.

기억해보면 과거에도 발생했던 에러 같습니다.


All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 28.0.0, 26.1.0. Examples include com.android.support:animated-vector-drawable:28.0.0 and com.android.support:support-media-compat:26.1.0


Inspection info:There are some combinations of libraries, or tools and libraries, that are incompatible, or can lead to bugs. One such incompatibility is compiling with a version of the Android support libraries that is not the latest version (or in particular, a version lower than your targetSdkVersion).


Issue id: GradleCompatible

28버전의 lib를 사용해야 하는데 어디선가(아마도 참고하는 다른 lib에서..).. 26.1.0버전의 com.android.support:support-media-compat를 사용해서 발생하는 문제입니다.

명시적으로 com.android.support:support-media-compat도 28.0.0버전을 사용하라고 추가하면 되네요.


implementation 'com.android.support:support-media-compat:28.0.0'
cs

그래들 파일에 위의 코드를 추가했습니다.



All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 28.0.0, 26.1.0. Examples include com.android.support:animated-vector-drawable:28.0.0 and com.android.support:support-v4:26.1.0 

Inspection info:There are some combinations of libraries, or tools and libraries, that are incompatible, or can lead to bugs. One such incompatibility is compiling with a version of the Android support libraries that is not the latest version (or in particular, a version lower than your targetSdkVersion).

그러니까 이번엔 다른 라이브러리에서 문제가 발생하네요.

같은 방식으로 문제의 라이브러리도 최신 버전을 명시해줍시다.


implementation 'com.android.support:support-v4:28.0.0'
cs


이렇게 하니 에러가 사라졌습니다.


음.. 그런데 앱을 실행하니 런타임 크래쉬가 발생하네요.

 java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/http/impl/cookie/DateUtils;
cs


AndroidManifest.xml의 <application> 바로 내부에 아래의 코드를 추가하면 됩니다.

<uses-library
            android:name="org.apache.http.legacy"
            android:required="false" />
cs

 


참고: https://developers.google.com/maps/documentation/android-sdk/config#specify_requirement_for_apache_http_legacy_library

0 Comments
제목
Category
State
  • 현재 접속자 3 명
  • 오늘 방문자 260 명
  • 어제 방문자 193 명
  • 최대 방문자 8,746 명
  • 전체 방문자 402,079 명
  • 전체 게시물 97 개
  • 전체 댓글수 18 개
  • 전체 회원수 49 명
Facebook Twitter GooglePlus KakaoStory NaverBand