【问题标题】:Could not resolve org.roboguice:roboguice:3.+无法解析 org.roboguice:roboguice:3.+
【发布时间】:2015-01-07 23:08:04
【问题描述】:

这是我的 build.gradle 文件:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.14.2'
    }
}
apply plugin: 'com.android.application'

repositories {
    jcenter()
}

android {
    compileSdkVersion 19
    buildToolsVersion "19.1.0"

    defaultConfig {
        applicationId "com.example.stopcall.app"
        minSdkVersion 14
        targetSdkVersion 19
        versionCode 1
        versionName "1.0"
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:support-v4:21.0.3'
    compile 'org.roboguice:roboguice:3.+'
    provided 'org.roboguice:roboblender:3.+'
}

我不知道为什么,但有时我在构建时遇到此错误:

Error:Gradle: A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
   > Could not resolve org.roboguice:roboguice:3.+.
     Required by:
         StopCall:app:unspecified
      > Failed to list versions for org.roboguice:roboguice.
         > Unable to load Maven meta-data from https://jcenter.bintray.com/org/roboguice/roboguice/maven-metadata.xml.
            > Could not GET 'https://jcenter.bintray.com/org/roboguice/roboguice/maven-metadata.xml'.
               > cache.corp.google.com: nodename nor servname provided, or not known
      > Failed to list versions for org.roboguice:roboguice.
         > Unable to load Maven meta-data from https://jcenter.bintray.com/org/roboguice/roboguice/maven-metadata.xml.
            > Could not GET 'https://jcenter.bintray.com/org/roboguice/roboguice/maven-metadata.xml'.
               > cache.corp.google.com
   > Could not resolve org.roboguice:roboblender:3.+.
     Required by:
         StopCall:app:unspecified
      > Failed to list versions for org.roboguice:roboblender.
         > Unable to load Maven meta-data from https://jcenter.bintray.com/org/roboguice/roboblender/maven-metadata.xml.
            > Could not GET 'https://jcenter.bintray.com/org/roboguice/roboblender/maven-metadata.xml'.
               > cache.corp.google.com
      > Failed to list versions for org.roboguice:roboblender.
         > Unable to load Maven meta-data from https://jcenter.bintray.com/org/roboguice/roboblender/maven-metadata.xml.
            > Could not GET 'https://jcenter.bintray.com/org/roboguice/roboblender/maven-metadata.xml'.
               > cache.corp.google.com



what can it be? as it can happen in a specific hour and few hours later (maybe another network) it might be fixed.

有什么想法吗?

【问题讨论】:

    标签: java build gradle guice roboguice


    【解决方案1】:

    您是否使用代理? 如果是这样,请检查您的 gradle 属性文件

    在 C:\Users\.gradle\ 下创建一个包含代理详细信息的 gradle.properties 文件:

    systemProp.http.proxyHost=hostname
    systemProp.http.proxyPort=8080
    systemProp.http.proxyUser=username
    systemProp.http.proxyPassword=xxx
    
    systemProp.https.proxyHost=hostname
    systemProp.https.proxyPort=8080
    systemProp.https.proxyUser=username
    systemProp.https.proxyPassword=password
    systemProp.https.nonProxyHosts=localhost
    

    【讨论】:

    • 这是我的工作笔记本电脑,所以当我想连接到我的工作网络时,我会使用 VPN 代理。但是当我在家中使用没有代理的私人 wifi 工作时,就会出现问题。
    • 我不想在.gradle 文件中写入我的凭据。没有别的办法吗?
    • 如果您使用的是 NTLM 代理,您可以尝试设置 cntlm.sourceforge.net。或者类似的东西在 android studio stackoverflow.com/a/18443524/3724365
    • 我在 intellij 工作。但为什么它甚至是必要的?由于 VPN 现已关闭
    • 应该只需要连接到互联网,除非您已将 gradle 配置为在没有活动连接的情况下工作。
    猜你喜欢
    • 2011-08-16
    • 2018-04-30
    • 1970-01-01
    • 1970-01-01
    • 2021-09-21
    • 2021-12-03
    • 2017-09-27
    • 2018-09-25
    • 1970-01-01
    相关资源
    最近更新 更多