0

I am receiving the following error when trying to sync gradle files in Android Studio:

A problem occurred configuring root project 'Test'.
> Could not resolve all files for configuration ':classpath'.
   > Could not resolve com.android.tools.build:gradle:7.4.0.
     Required by:
         project : > com.android.application:com.android.application.gradle.plugin:7.4.0
         project : > com.android.library:com.android.library.gradle.plugin:7.4.0
      > No matching variant of com.android.tools.build:gradle:7.4.0 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.6' but:
          - Variant 'apiElements' capability com.android.tools.build:gradle:7.4.0 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.6')
          - Variant 'javadocElements' capability com.android.tools.build:gradle:7.4.0 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.6')
          - Variant 'runtimeElements' capability com.android.tools.build:gradle:7.4.0 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.6')
          - Variant 'sourcesElements' capability com.android.tools.build:gradle:7.4.0 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.6')

Which seems to point out that I am using a Java runtime of version 8, and require it to be set to version 11.

How do I stop this error and change my Java runtime version?

Is version 11 also an outdated version of Java runtime?

What are the downfalls of using an outdated version?

dan1st
  • 12,568
  • 8
  • 34
  • 67
Kastor438
  • 37
  • 8
  • Please do not change your question in a way that it is asking something completely different if there are already answers to it. It is no problem if one of your questions is a duplicate. In case you have a new question, please ask it as a separate question. – dan1st Feb 20 '23 at 13:26
  • @dan1st It is a problem. I can't ask new question until I satisfy the issue of the this duplicate. The question is a duplicate as I acknowledged a while ago. I can't edit the question to no loner be a duplicate, meaning I can not satisfy what Stackoverflow wants me to do to be allowed to ask new questions. If I can't edit this question to not be a duplicate, and I can't post until I do make this question a non-duplicate question, what am I supposed to do? – Kastor438 Feb 24 '23 at 19:53

1 Answers1

1

You must change Gradle JDK version to 11.

enter image description here

Halil Ozel
  • 2,482
  • 3
  • 17
  • 32