我的Flutter应用程序的构建失败,因为我安装了新的Java 17版本。
我已经在Android Studio中更新了JAVA_HOME
和gradle用户主页。
这就是我的gradle-wrapper.properties
文件的样子
#Fri Jun 23 08:50:38 CEST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-all.zip
字符串
这是我收到的错误消息:
A problem occurred configuring project ':cloud_firestore'.
> Could not resolve all files for configuration ':cloud_firestore:classpath'.
> Could not resolve com.android.tools.build:gradle:8.1.2.
Required by:
project :cloud_firestore
> No matching variant of com.android.tools.build:gradle:8.1.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.6.1' but:
- Variant 'apiElements' capability com.android.tools.build:gradle:8.1.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.6.1')
- Variant 'javadocElements' capability com.android.tools.build:gradle:8.1.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.6.1')
- Variant 'runtimeElements' capability com.android.tools.build:gradle:8.1.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.6.1')
- Variant 'sourcesElements' capability com.android.tools.build:gradle:8.1.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.6.1')
> Failed to notify project evaluation listener.
> Could not get unknown property 'android' for project ':cloud_firestore' of type org.gradle.api.Project.
> Could not find method implementation() for arguments [project ':firebase_core'] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
> Could not get unknown property 'android' for project ':cloud_firestore' of type org.gradle.api.Project.
型
1条答案
按热度按时间7fyelxc51#
你可以做这个检查:
将Gradle JDK更改为与新升级兼容的版本。
文件->设置->构建、执行、部署->构建工具-> Gradle
一旦完成,建议进行:
文件->无效缓存/重新启动