728x90

문제

 

테스트 빌드중에 

connectedDebugAndroidTest 에서 영원한 로딩에 굴레에 갇히는 일이 있었다.. (테스트빌드 말고 그냥빌드는 잘됨....& unit test 도 잘됨.... instrumental test만 난리남)

 

Androidx.test.espresso:espresso-core

 

해당 의존성을 3.5.0 -> 3.4.0 으로 내리니 빌드가 정상적으로 되긴 했지만

해당 라이브러리가 배포된지도 좀 되었고 다른 프로젝트에서는 잘 되기에… 

다른 문제가 있겠거니 해서 열심히 뒤적거렸다. 

 

해결 

 

힐트 테스트 디펜던시가 implementation 으로 되어있는것을 발견.. 

공식문서에는 테스트 스코프로 명시되어있다 

 

 

https://developer.android.com/training/dependency-injection/hilt-testing?hl=ko#testing-dependencies

 

Hilt 테스트 가이드  |  Android 개발자  |  Android Developers

Hilt 테스트 가이드 컬렉션을 사용해 정리하기 내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요. Hilt와 같은 종속 항목 삽입 프레임워크를 사용하여 얻을 수 있는 이점 중 하나는 코드를

developer.android.com

 

이를 testImplementation 과 androidTestImplementation 으로 교체해주니 빌드도 테스트도 잘 된다. 

 

 

dependencies {
// AS-IS
	implementation("com.google.dagger:hilt-android-testing:2.44")

// TO-BE
    testImplementation("com.google.dagger:hilt-android-testing:2.44")
    androidTestImplementation("com.google.dagger:hilt-android-testing:2.44")
}

 

공식문서를 잘 보자 흑흑

해결하는데 이틀꼬박걸림 

 

아래는 유입을 위한 추적하면서 마주친 에러메시지들 

 

더보기

로그캣

 

java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/test/platform/io/PlatformTestStorageRegistry;

 

 

테스트 실패 메시지 (무한로딩걸리는 부분)

 

Execution failed for task ':app:connectedDebugAndroidTest'.

 

 

디펜던시 오류 메시지

 

Cannot find a version of 'androidx.test:monitor' that satisfies the version constraints:

   Dependency path ':app:unspecified' --> 'androidx.test:monitor:1.6.1'

   Constraint path ':app:unspecified' --> 'androidx.test:monitor:{strictly 1.4.0}' because of the following reason: debugRuntimeClasspath uses version 1.4.0

728x90

+ Recent posts