반응형

안녕하세요. Simple& Happy Dev입니다.

최신 SDK Tool 몇 개 업데이트하고 업그레이드된 라이브러리 몇 개도 업데이트해서 테스트한 후 다시 이전 상태로 돌리고, 클린 빌드를 했는데, Unresolved dependencies (2 errors) 오류가 발생했습니다.

에러 내용은 아래처럼 Failed to resolve: play-services-basement 라고 나오는데, com.google.android.gms:play-services-basement에 문제가 있어서 발생한 현상입니다.

Gradle window(View - Tool windows - Gradle 또는 Tool Buttons가 활성화 되어 있는 경우 오른편 위의 Gradle 아이콘 클릭)에서 androidDependencies를 실행하면 아래와 같이 오류를 확인할 수 있었습니다.

:app:androidDependencies FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:androidDependencies'.
> Could not resolve all artifacts for configuration ':app:debugCompileClasspath'.
   > Could not find play-services-basement.aar (com.google.android.gms:play-services-basement:15.0.1).
     Searched in the following locations:
         https://jcenter.bintray.com/com/google/android/gms/play-services-basement/15.0.1/play-services-basement-15.0.1.aar

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 0s

이 오류는 jcenter Repository에서 "com.google.android.gms:play-services-basement:15.0.1@aar"를 못 가져와서 오류를 발생시킨 것입니다.

몇 가지 테스트를 해보니 두 가지 방법으로 해결할 수 있었습니다.

#1 gms 상위버전으로 업데이트  

최근에 릴리즈된 gms의 상위 버전으로 라이브러리 업데이트 후 Sync Project with Gradle Files (툴바의 3번째 버튼 or File 메뉴에서 선택)를 실행하고 빌드하면 오류가 발생하지 않습니다.

여기서 주의하실 점은 androidDependencies를 실행하셔서 "com.google.android.gms:play-services-basement:15.0.1@aar"가 존재하는 라이브러리는 모두 상위 버전으로 업그레이드해 주셔야 합니다. 

#2 Repository 조정

gms 상위 버전에서는 문제없는 것으로 보아서 jcenter Repository의 15.0.1을 가져오지 못하는 것으로 보입니다.

Gradle 빌드시 제일 위의 Repository부터 체크하기 때문에 jcenter Repository를 뒤쪽으로 이동하게 해서 Google의 Maven Repository에서 "com.google.android.gms:play-services-basement:15.0.1@aar"를 가져오게 하면 됩니다.

build.gradle (Project) 파일에서 아래 두 가지중 하나를 선택해서 수정하고 Sync Project with Gradle Files를 실행하고 빌드하면 오류가 발생하지 않습니다.


Gradle 버전 4.1 이상


Gradle 버전 4.1 미만


 

※앱에서 상위 버전으로 업데이트를 하면 문제가 될 경우에만 Repository를 조정하는 방법을 이용하세요.
   될 수 있으면 구글에서 권장하는 jcenter를 처음에 두는 것으로 Repository 순서를 유지하고 "상위 버전으로 업데이트"
   하는 방법을 권장해드립니다.

위와 유사한 문제 발생으로 고생하고 계신다면 한 번 참조하시어 테스트해보시길 바랍니다.

조금이나마 도움이 되셨으면 아래 공감 버튼을 눌러주세요.
(If this article helps you, please press the button below.)

+ Recent posts