我刚刚创建了一个全新的Material 3 Compose项目,弹出了这个:

> 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.5' 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.5')
          - 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.5')
          - 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.5')
          - 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.5')

没有更改任何内容,一切都是默认设置.

推荐答案

最终将Gradle JDK更改为11.

文件-&>设置-&>;生成、执行、部署->;生成工具->;Gradle

Android相关问答推荐

三星上的某些应用程序已禁用通知权限切换

如何在Android Emulator上从物理设备接收TCP消息

懒惰的垂直网格中盒子的重量-Jetpack组合

Android和Rust,OpenSSL交叉编译在ARM V7上链接失败

第一次使用onBackPressed()、NavigateUp()加载时MapView崩溃

未解析的引用:视图模型

需要在按钮 onclick 上从 string.xml 获取值. @Composable 调用只能在@Composable 函数的上下文中发生

通过 setIntentScanningStrategyEnabled(true) 未检测到信标的 Android Beacon 库后台扫描

如何在 Jetpack Compose 中对齐按钮底部中心?

java.lang.ExceptionInInitializerError -- 原因:java.lang.NullPointerException

如何在 Delphi 和 Android 上避免 Indy Socket Error #13 Access denied 异常?

如何用jetpack compose实现垂直李克特量表

在 Jetpack Compose 中使用 ViewModel 实现 startActivity 的最佳实践

从 Firebase 云存储中获取照片会导致 Android Jetpack Compose 闪烁

GridLayout 和 GridView 有什么好用和区别

将应用更改为暗模式后 Android MainActivity 数据泄漏

如何处理 com.google.gson.JsonSyntaxException: java.lang.NumberFormatException: For input string: "T1V 4Y8" Kotlin

我的 react native 项目的发布签名 apk 没有在设备中打开,而且它创建的尺寸非常小

为什么按钮没有拉伸到屏幕边缘?

在 android-billing-5.0 中获取 ProductDetails 价格