我使用Intellij向导创建了我的简单项目,用来创建Kotlin控制台应用程序,但是看起来Gradle同步不起作用(这个项目甚至还没有构建)。我尝试了很多在互联网上找到的解决方案。
,
我在Android工作室和android开发公司工作。他们有可能搞砸他们之间的配置吗?在Android上,我在运行和配置Android项目时没有问题。
我能问一些关于下一步该做什么的建议吗?我敢肯定,我错过了一些可笑的东西。或者你能给我一些Gradle Kotlin的模板代码吗?
我真的很想开始写项目代码。
(事先非常感谢:)
以下是构建错误:
A problem occurred configuring root project 'MyProject'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not resolve org.jetbrains.kotlin:kotlin-stdlib:1.4.20.
Required by:
project :
> Could not resolve org.jetbrains.kotlin:kotlin-stdlib:1.4.20.
> Could not get resource 'https://plugins.gradle.org/m2/org/jetbrains/kotlin/kotlin-stdlib/1.4.20/kotlin-stdlib-1.4.20.pom'.
> Could not GET 'https://plugins.gradle.org/m2/org/jetbrains/kotlin/kotlin-stdlib/1.4.20/kotlin-stdlib-1.4.20.pom'.
> java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
> Could not resolve org.jetbrains.kotlin:kotlin-reflect:1.4.20.
Required by:
project :
> Could not resolve org.jetbrains.kotlin:kotlin-reflect:1.4.20.
> Could not get resource 'https://plugins.gradle.org/m2/org/jetbrains/kotlin/kotlin-reflect/1.4.20/kotlin-reflect-1.4.20.pom'.
> Could not GET 'https://plugins.gradle.org/m2/org/jetbrains/kotlin/kotlin-reflect/1.4.20/kotlin-reflect-1.4.20.pom'.
> java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
> Could not resolve org.jetbrains.kotlin:kotlin-stdlib-common:1.4.20.
Required by:
project :
> Could not resolve org.jetbrains.kotlin:kotlin-stdlib-common:1.4.20.
> Could not get resource 'https://plugins.gradle.org/m2/org/jetbrains/kotlin/kotlin-stdlib-common/1.4.20/kotlin-stdlib-common-1.4.20.pom'.
> Could not GET 'https://plugins.gradle.org/m2/org/jetbrains/kotlin/kotlin-stdlib-common/1.4.20/kotlin-stdlib-common-1.4.20.pom'.
> java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
> Could not resolve org.jetbrains.kotlin:kotlin-stdlib:1.4.20.
Required by:
project : > org.jetbrains.kotlin.jvm:org.jetbrains.kotlin.jvm.gradle.plugin:1.5.0 > org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.0
project : > org.jetbrains.kotlin.jvm:org.jetbrains.kotlin.jvm.gradle.plugin:1.5.0 > org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.0 > org.jetbrains.kotlin:kotlin-gradle-plugin-api:1.5.0
project : > org.jetbrains.kotlin.jvm:org.jetbrains.kotlin.jvm.gradle.plugin:1.5.0 > org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.0 > org.jetbrains.kotlin:kotlin-gradle-plugin-model:1.5.0
project : > org.jetbrains.kotlin.jvm:org.jetbrains.kotlin.jvm.gradle.plugin:1.5.0 > org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.0 > org.jetbrains.kotlin:kotlin-util-klib:1.5.0
project : > org.jetbrains.kotlin.jvm:org.jetbrains.kotlin.jvm.gradle.plugin:1.5.0 > org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.0 > org.jetbrains.kotlin:kotlin-compiler-embeddable:1.5.0
project : > org.jetbrains.kotlin.jvm:org.jetbrains.kotlin.jvm.gradle.plugin:1.5.0 > org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.0 > org.jetbrains.kotlin:kotlin-annotation-processing-gradle:1.5.0
project : > org.jetbrains.kotlin.jvm:org.jetbrains.kotlin.jvm.gradle.plugin:1.5.0 > org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.0 > org.jetbrains.kotlin:kotlin-scripting-compiler-embeddable:1.5.0
project : > org.jetbrains.kotlin.jvm:org.jetbrains.kotlin.jvm.gradle.plugin:1.5.0 > org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.0 > org.jetbrains.kotlin:kotlin-scripting-compiler-impl-embeddable:1.5.0
project : > org.jetbrains.kotlin.jvm:org.jetbrains.kotlin.jvm.gradle.plugin:1.5.0 > org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.0 > org.jetbrains.kotlin:kotlin-util-klib:1.5.0 > org.jetbrains.kotlin:kotlin-util-io:1.5.0
project : > org.jetbrains.kotlin.jvm:org.jetbrains.kotlin.jvm.gradle.plugin:1.5.0 > org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.0 > org.jetbrains.kotlin:kotlin-scripting-compiler-impl-embeddable:1.5.0 > org.jetbrains.kotlin:kotlin-scripting-common:1.5.0
project : > org.jetbrains.kotlin.jvm:org.jetbrains.kotlin.jvm.gradle.plugin:1.5.0 > org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.0 > org.jetbrains.kotlin:kotlin-scripting-compiler-impl-embeddable:1.5.0 > org.jetbrains.kotlin:kotlin-scripting-jvm:1.5.0
> Could not resolve org.jetbrains.kotlin:kotlin-stdlib:1.4.20.
> Could not get resource 'https://plugins.gradle.org/m2/org/jetbrains/kotlin/kotlin-stdlib/1.4.20/kotlin-stdlib-1.4.20.pom'.
> Could not GET 'https://plugins.gradle.org/m2/org/jetbrains/kotlin/kotlin-stdlib/1.4.20/kotlin-stdlib-1.4.20.pom'.
> java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
> Could not resolve org.jetbrains.kotlin:kotlin-reflect:1.4.20.
Required by:
project : > org.jetbrains.kotlin.jvm:org.jetbrains.kotlin.jvm.gradle.plugin:1.5.0 > org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.0
project : > org.jetbrains.kotlin.jvm:org.jetbrains.kotlin.jvm.gradle.plugin:1.5.0 > org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.0 > org.jetbrains.kotlin:kotlin-compiler-embeddable:1.5.0
project : > org.jetbrains.kotlin.jvm:org.jetbrains.kotlin.jvm.gradle.plugin:1.5.0 > org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.0 > org.jetbrains.kotlin:kotlin-compiler-runner:1.5.0 > org.jetbrains.kotlin:kotlin-daemon-client:1.5.0
> Could not resolve org.jetbrains.kotlin:kotlin-reflect:1.4.20.
> Could not get resource 'https://plugins.gradle.org/m2/org/jetbrains/kotlin/kotlin-reflect/1.4.20/kotlin-reflect-1.4.20.pom'.
> Could not GET 'https://plugins.gradle.org/m2/org/jetbrains/kotlin/kotlin-reflect/1.4.20/kotlin-reflect-1.4.20.pom'.
> java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
> Could not resolve org.jetbrains.kotlin:kotlin-stdlib:1.4.20.
Required by:
project : > org.jetbrains.kotlin.jvm:org.jetbrains.kotlin.jvm.gradle.plugin:1.5.0 > org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.0 > org.jetbrains.kotlin:kotlin-compiler-runner:1.5.0 > org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.8
> Could not resolve org.jetbrains.kotlin:kotlin-stdlib:1.4.20.
> Could not get resource 'https://plugins.gradle.org/m2/org/jetbrains/kotlin/kotlin-stdlib/1.4.20/kotlin-stdlib-1.4.20.pom'.
> Could not GET 'https://plugins.gradle.org/m2/org/jetbrains/kotlin/kotlin-stdlib/1.4.20/kotlin-stdlib-1.4.20.pom'.
> java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
> Could not resolve org.jetbrains.kotlin:kotlin-stdlib-common:1.4.20.
Required by:
project : > org.jetbrains.kotlin.jvm:org.jetbrains.kotlin.jvm.gradle.plugin:1.5.0 > org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.0 > org.jetbrains.kotlin:kotlin-compiler-runner:1.5.0 > org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.8
> Could not resolve org.jetbrains.kotlin:kotlin-stdlib-common:1.4.20.
> Could not get resource 'https://plugins.gradle.org/m2/org/jetbrains/kotlin/kotlin-stdlib-common/1.4.20/kotlin-stdlib-common-1.4.20.pom'.
> Could not GET 'https://plugins.gradle.org/m2/org/jetbrains/kotlin/kotlin-stdlib-common/1.4.20/kotlin-stdlib-common-1.4.20.pom'.
> java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
* Run with --scan
> * Where:
> Auto-applied by using --scan
> What went wrong:
>Plugin [id: 'com.gradle.enterprise', version: '3.5', artifact: 'com.gradle:gradle-enterprise-gradle-plugin:3.5'] was >not found in any of the following sources:
>- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
>- Plugin Repositories (could not resolve plugin artifact 'com.gradle:gradle-enterprise-gradle-plugin:3.5')
> Searched in the following repositories:
> Gradle Central Plugin Repository

编辑:看,我已经损坏了项目树。我试图再次创建项目,然后在project文件树视图中再次看到一些奇怪的东西

编辑2:正如你在编辑1中看到的:有些东西真的很奇怪。为此,我添加了另一张图片,其中我显示了另一个具有类似问题的项目(我做了大概10个,而且我总是有一些类似的问题)。我很困惑:/

编辑3:
我尝试使用不同的JDK --我将它改为Adobe,问题解决了。谢谢您:)

发布于 2021-05-16 17:21:02
解决方案是,万一JDK损坏了,正如@Ananiya Jemberu在注释部分中建议的那样,它对我起了作用。
我尝试使用不同的JDK --我将它改为Adobe,问题解决了。

https://stackoverflow.com/questions/67547685
复制相似问题