멀티모듈에다 여러 써드파티 라이브러리들까지 뭉탱이로 넣은 프로젝트 설정은 너무 힘들다..
오늘만 열개 정도는 해결한 것 같은데, 난 보통 이런 오류를 마주할 때마다 무지성 수정을 하는 경우가 많다.
특히 하루에 열댓개씩 터져나오는 경우에는 스트레스 때문에 더더욱..
정확히 요점을 짚어내기 보다는 조금 읽고 이 부분이 문젠가? 수정 -> 아니네 여긴가? 수정 -> 반복.. 이런식이다.
하지만 아무리 갑갑해도 에러 메시지를 꼼꼼히 읽고 가려운 부분을 정확하게 긁어줘야 금방 해결할 수 있다.
아래 에러 메시지는 그 중에서 제일 해결이 오래 걸린 오류이다.
A problem occurred configuring root project 'MyApp'.
> Could not resolve all files for configuration ':classpath'.
> Could not resolve com.android.tools.build:gradle:7.4.2.
Required by:
project : > com.android.application:com.android.application.gradle.plugin:7.4.2
project : > com.android.library:com.android.library.gradle.plugin:7.4.2
> No matching variant of com.android.tools.build:gradle:7.4.2 was found. The consumer was configured to find a runtime of a library compatible with Java 8, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '7.5' but:
- Variant 'apiElements' capability com.android.tools.build:gradle:7.4.2 declares a library, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares an API of a component compatible with Java 11 and the consumer needed a runtime of a component compatible with Java 8
- Other compatible attribute:
- Doesn't say anything about org.gradle.plugin.api-version (required '7.5')
- Variant 'javadocElements' capability com.android.tools.build:gradle:7.4.2 declares a runtime of a component, and its dependencies declared externally:
- Incompatible because this component declares documentation and the consumer needed a library
- Other compatible attributes:
- Doesn't say anything about its target Java version (required compatibility with Java 8)
- Doesn't say anything about its elements (required them packaged as a jar)
- Doesn't say anything about org.gradle.plugin.api-version (required '7.5')
- Variant 'runtimeElements' capability com.android.tools.build:gradle:7.4.2 declares a runtime of a library, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares a component compatible with Java 11 and the consumer needed a component compatible with Java 8
- Other compatible attribute:
- Doesn't say anything about org.gradle.plugin.api-version (required '7.5')
- Variant 'sourcesElements' capability com.android.tools.build:gradle:7.4.2 declares a runtime of a component, and its dependencies declared externally:
- Incompatible because this component declares documentation and the consumer needed a library
- Other compatible attributes:
- Doesn't say anything about its target Java version (required compatibility with Java 8)
- Doesn't say anything about its elements (required them packaged as a jar)
- Doesn't say anything about org.gradle.plugin.api-version (required '7.5')
위 이슈는 프로젝트가 Jdk 1.8과 gradle 7.5버전을 같이 사용해서 발생한 문제이다.
gradle 7.3.0 버전 부터는 최소 jdk 11 이상이 요구되기 때문에, jdk 버전만 수정해주면 위 오류는 간단히 해결할 수 있다.
나는 현재
Jdk 11
gradle plugin 7.4.2
gradle 7.5
위와 같이 사용하고 있다.
트러블슈팅에 도움이 되었다면 하단의 하트 버튼을 눌러주세요!
수익창출은 없지만 포스팅을 작성하는 원동력이 됩니다
'개발 > 트러블슈팅' 카테고리의 다른 글
[안드로이드] FragmentContainerView NullPointerException 해결 (0) | 2023.05.27 |
---|---|
[안드로이드] is not abstract and does not implement abstract member public abstract fun getActionId() 오류 (0) | 2023.04.17 |
[안드로이드] Circular dependency 오류 (0) | 2023.04.13 |
[안드로이드] by viewModels() 종속성 추가 (0) | 2023.04.12 |
[안드로이드] ViewModelProvider gradle 오류 (0) | 2022.09.29 |