안드로이드 유닛 테스트를 하던 중 갑자기 에러를 마주하게 되었습니다.

에러 코드를 찾고, 고쳐보았으나 해결이 되지 않아 크게 당황하였습니다. 🙀
결국 인터넷 검색을 하게 되었고 에러를 해결할 수 있었습니다.

그렇다면 문제가 무엇이었을까요??
dependencies {
testImplementation 'android.arch.core:core-testing:1.1.1'
}
위의 코드에서 $arch_core_version 의 버전이 필요한 버전보다 낮게 설정이 되어있어서 발생하게 되는 오류였습니다.
maven에서 버전을 확인하던 중 에러에 대한 확실한 정보를 얻을 수 있었습니다.

위의 그림의 빨간색 박스를 보시면, "This artifact was moved to..." 를 볼 수 있습니다!
여기서 core-testing을 누르면 바뀐 버전을 확인할 수 있습니다.
dependencies{
testImplementation("androidx.arch.core:core-testing:2.1.0")
}
위의 코드로 수정해주시면, error 가 해결되는 것을 확인할 수 있습니다!!

참고자료
[Android/Kotlin] Live Data 테스트 오류 (Method getMainLooper in android.os.Looper not mocked.)
Live Data 테스트 오류 (Method getMainLooper in android.os.Looper not mocked.) 안드로이드 개발 중 TDD 개발 방식 연습 중 오류가 발생하였다. 알고 보니 라이브 데이터를 테스트하기 위한 설정이 잘 못 되..
potato-idiot.tistory.com
'Android Studio' 카테고리의 다른 글
| [Android] Memory Leak 방지를 도와주는 LeakCanary 사용해보기 (0) | 2022.08.25 |
|---|---|
| 코드랩을 활용한 LiveData, DataBinding 공부 (0) | 2022.06.17 |
| [error] cannot create an instance of class ... viewmodel (0) | 2022.05.21 |
| [Android] LiveData 란? (0) | 2022.04.29 |
| [Android / kotlin] Mapper (0) | 2022.04.21 |