Jun*_*ncu 133 android android-studio
我刚刚创建了一个全新的 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')
Run Code Online (Sandbox Code Playgroud)
没有改变任何东西,一切都是默认的。
Jun*_*ncu 274
最终将 Gradle JDK 更改为 11。
File-> Settings-> Build, Execution, Deployment-> Build Tools->Gradle
cho*_*nge 16
如果在 Kotlin Multiplatform (KMM) 上升级到 Java 17。
当您创建新的 KMM 项目时,Android Studio 的 Gradle 构建设置自动默认为Java 1.8(或为 JAVA_HOME 或 org.gradle.java.jome 指定的任何内容)。
如果您升级到Android Java 11Studio,Java 13它将成功构建并在 Android Studio 上运行,但不会在 Xcode 上成功构建或运行。
解决方法(似乎)是再升级一个版本Java 17(在我的例子中是亚马逊的 corretto-17)
使用低于 17 的版本似乎破坏了 Xcode 中预期的 Gradle 插件版本(但仅限于 Xcode)——这会引入文件夹的范围问题shared。
使用 CocoaPods 和常规框架创建新项目时进行了测试。
Android Studio Flamingo并排测试Xcode version 14.3
小智 10
需要做两步...
将 Gradle JDK 更改为 11。
文件 -> 设置 -> 构建、执行、部署 -> 构建工具 -> Gradle
然后
文件 -> 修复 IDE。执行每个步骤,直到重新启动,然后开始下载大量文件。此后构建工作。
| 归档时间: |
|
| 查看次数: |
91892 次 |
| 最近记录: |