无法使用jcenter解析Android Studio中的依赖项

Ali*_*adi 6 android build-tools android-studio android-gradle-plugin

为什么我的程序挂起来解决andorid studio中appDebug的依赖性?我无法解决任何库.

这是我的根gradle文件:

buildscript {
repositories {

    jcenter()

}
dependencies {
    classpath 'com.android.tools.build:gradle:1.5.0'

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

allprojects {
repositories {
    jcenter()
}
}
Run Code Online (Sandbox Code Playgroud)

这是我的应用程序gradle:

apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion "23.0.2"

defaultConfig {
    applicationId "com.example.alimohammadi.myapplication"
    minSdkVersion 15
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
}
Run Code Online (Sandbox Code Playgroud)

我无法解决junit问题.我无法使用我的浏览器访问https://jcenter.bintray.com/(它给了我连接超时,而其他网站返回真实响应).

Ali*_*adi 11

经过一天的浪费,我发现这是给伊朗开发商的礼物:D

最后,我切换回mavenCentral().在我的根gradle中更改为mavenCentral().问题解决了.

我的root build.gradle文件转到下面的代码:

buildscript {
repositories {

   mavenCentral()

}
dependencies {
    classpath 'com.android.tools.build:gradle:1.5.0'
}
}

allprojects {
repositories {
    mavenCentral()
}
}
Run Code Online (Sandbox Code Playgroud)

mevenCentral中不存在某些库,因此我们必须将代理添加到我们的gradle.properties文件中,如下所示访问jcenter:D

systemProp.http.proxyHost=www.somehost.org
systemProp.http.proxyPort=8080
systemProp.http.proxyUser=user
systemProp.http.proxyPassword=password
systemProp.http.nonProxyHosts=localhost
systemProp.http.auth.ntlm.domain=domain
Run Code Online (Sandbox Code Playgroud)

或者对于https

systemProp.https.proxyHost=www.somehost.org
systemProp.https.proxyPort=8080
systemProp.https.proxyUser=user
systemProp.https.proxyPassword=password
systemProp.https.nonProxyHosts=localhost
systemProp.https.auth.ntlm.domain=domain
Run Code Online (Sandbox Code Playgroud)