简体   繁体   English

由于缺少jcenter证书,无法构建现有应用程序-被gradle阻止

[英]Failed to build an existing application due to lack of jcenter certificate - blocked by gradle

I tried to build an andruid application using latest andruid studio Seems that gradle is blocked due to lack of jcenter certificate in local machine certstore. 我试图使用最新的andruid Studio构建一个andruid应用程序。似乎gradle被阻止,因为本地计算机certstore中缺少jcenter证书。 My colleguee succeed to build it on his machine so the problem is in the configuration and not the application code 我的同事成功在其计算机上构建了它,所以问题出在配置中,而不是应用程序代码中

Configuration : andruid studio 3.0.1, gradle 3.0.0 ?, windows 7 配置:andruid studio 3.0.1,gradle 3.0.0?,Windows 7

I also tried to workaround ssl handshake by replacing jcenter() in build.gradle with 我还尝试通过用build.gradle替换jcenter()解决ssl握手

 maven {
            url  "http://jcenter.bintray.com"
        }

but it didn't solve the problem 但这并不能解决问题

My build.gradle below: 我的build.gradle如下:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0'

        // 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
}

Gradle console: Gradle控制台:

Executing tasks: [assemble]

Configuration on demand is an incubating feature.

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'PDA'.
> Could not resolve all files for configuration ':classpath'.
   > Could not resolve com.android.tools.build:gradle:3.0.0.
     Required by:
         project :
      > Could not resolve com.android.tools.build:gradle:3.0.0.
         > Could not get resource 'http://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom'.
            > Could not HEAD 'http://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom'.
               > Connect to repo.jfrog.org:80 [repo.jfrog.org/52.72.224.151, repo.jfrog.org/34.204.33.255] failed: Connection timed out: connect

The plugin v. 3.xx 插件3.xx版

 classpath 'com.android.tools.build:gradle:3.0.0'

is not in jcenter . 不在 jcenter
You have to use the google maven repo. 您必须使用Google Maven存储库。

buildscript {
    repositories {
        jcenter()
        maven {
            url "https://maven.google.com"
        }
    }
}

If you are using Android Studio 3 and gradle v.4.x you can use the google() shortcut 如果您使用的是Android Studio 3和Gradle v.4.x,则可以使用google()快捷方式

buildscript {
    repositories {
        ... 
        google()
    }
}

Besides as @GabrieleMariotti alreay said, that library will not be found at JCenter, you should not get Connection timed out: connect but a message that the library was not found. 除了@GabrieleMariotti alreay所说的那样,该库不会在JCenter上找到,您也不应使Connection timed out: connect但提示未找到该库。

Connection timed out: connect hints, that you cannot access that URL from your machine. Connection timed out: connect提示,您无法从计算机访问该URL。 My best guess is that you have to use some Proxy to access this URL that properly configured for your colleague, but not for you. 我最好的猜测是,您必须使用某些代理来访问为您的同事(而不是您)正确配置的URL。

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

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