Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

Want to improve this question? Add details and clarify the problem by editing this post .

Closed last month .

After flamingo update unable to create project it showing some errors:

No matching variant of com.android.tools.build:gradle:8.0.0 was found. The consumer was configured to find a library for use during runtime, compatible with Java 8, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '8.0'

A problem occurred configuring root project 'My Application'.
> Could not resolve all files for configuration ':classpath'.
   > Could not resolve com.android.tools.build:gradle:8.0.0.
     Required by:
         project : > com.android.application:com.android.application.gradle.plugin:8.0.0
         project : > com.android.library:com.android.library.gradle.plugin:8.0.0
      > No matching variant of com.android.tools.build:gradle:8.0.0 was found. The consumer was configured to find a library for use during runtime, compatible with Java 8, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '8.0' but:
          - Variant 'apiElements' capability com.android.tools.build:gradle:8.0.0 declares a library, packaged as a jar, and its dependencies declared externally:
              - Incompatible because this component declares a component for use during compile-time, compatible with Java 11 and the consumer needed a component for use during runtime, compatible with Java 8
              - Other compatible attribute:
                  - Doesn't say anything about org.gradle.plugin.api-version (required '8.0')
          - Variant 'javadocElements' capability com.android.tools.build:gradle:8.0.0 declares a component for use during runtime, and its dependencies declared externally:
              - Incompatible because this component declares documentation and the consumer needed a library

I try but still getting this error

That is a bug of Android Studio. The new Android Gradle Plugin 8.0.0 now requires to be executed with Java 17. If you upgrade from an older Android Studio version usually on older Java version is configured and thus Gradle fails with the error you have posted.

To make the build process work again you have to configure JDK to be used to Java 17:

Menu File -> Settings -> Build, Execution, Deployment -> Build Tools -> Gradle -> Gradle JDK

Android Studio automatically installs an appropriate Java 17 version jbr-17 so you just have to switch to this Java 17 JDK.

On file level changing the JDK changes/adds the entry <option name="gradleJvm" value="Embedded JDK" /> in the file .idea/gradle.xml in the project directory.

How can I make it automatic that whenever a new project is created it uses the Java 17 JDK? – Paul May 5 at 7:27 @Paul It seems to me like AS simply uses the first JDK in it's sorted list of available JDKs (see file options/jdk.table.xml in AS preferences). Even renaming or re-sorting the JDK entries in jdk.table.xml has no effect so I would consider this as a bug. – Robert May 5 at 9:30