반응형

이번글은 안드로이드 스튜디오에서 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 문제 해결 방법에 대해 글을 기록한다.


안드로이드 스튜디오 설치를 하고, 개발 환경을 구축하는데 아래와 같이 에러가 발생했다.

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

 

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 이 에러가 발생했다. 에러의 풀 내용은 아래와 같다.

A problem occurred configuring root project 'check'.
> 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 버전이 낮아 해당하는 gradle tool을 빌드하지 못해 발생한 문제다. 해결 방법은 아래와 같다.


1. [File] - [Settings...]를 클릭한다.

 

2. [Settings] 화면에서 Gradle JDK 버전을 변경한다.

- [Build, Execution, Deployment] - [Build Tools] - [Gradle]에 들어가면 아래의 화면에서 Gradle JDK에서 JDK 버전을 변경하면 된다.

 

3. 변경을 한 후에, [Sync] 탭에서 오른쪽 클릭 후, [Reload Gradle Project]를 클릭해서 프로젝트를 리로드한다.

 

4. 리로드를 하면 아래와 같이 BUILD SUCCESSFUL이 나온다. 그러면 끝이다.


 

반응형
  • 네이버 블러그 공유하기
  • 네이버 밴드에 공유하기
  • 페이스북 공유하기
  • 카카오스토리 공유하기