简体   繁体   English

将Kotlin下载到Android Studio时出现与证书相关的错误

[英]Getting certificate-related error when downloading Kotlin into Android Studio

What I'm trying to accomplish: 我想要完成的事情:

So I'm trying to install Kotlin into Android Studio. 所以我正在尝试将Kotlin安装到Android Studio中。 I believe it is installed, but I get an error when Gradle tries to build the project. 我相信它已安装,但是当Gradle尝试构建项目时出现错误。 This is where my error comes in. 这就是我的错误所在。

The problem: 问题:

When Gradle tries to build the project, it gives me this error: 当Gradle尝试构建项目时,它会给我这个错误:

Error: Cause: unable to find valid certification path to requested target 错误:原因:无法找到所请求目标的有效证书路径

This is my build.gradle project file: 这是我的build.gradle项目文件:

buildscript {
    ext.kotlin_version = '1.1.2-4'
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.2'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

I'm not sure what the problem is here. 我不确定这里的问题是什么。

You need to declare google maven central repository. 您需要声明google maven中央存储库。

buildscript {
  ext.kotlin_version = '1.1.2-4'
  repositories {
    maven { url 'https://maven.google.com' } // This one
    jcenter()
  }
  dependencies {
    classpath 'com.android.tools.build:gradle:3.0.0-alpha3'
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

  }
}

allprojects {
  repositories {
    maven { url 'https://maven.google.com' } // And this one
    jcenter()
    mavenCentral()
  }
}

task clean(type: Delete) {
  delete rootProject.buildDir
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM