Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/343.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 无法解析org.roboguice:roboguice:3+_Java_Build_Gradle_Guice_Roboguice - Fatal编程技术网

Java 无法解析org.roboguice:roboguice:3+

Java 无法解析org.roboguice:roboguice:3+,java,build,gradle,guice,roboguice,Java,Build,Gradle,Guice,Roboguice,这是我的build.gradle文件: buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:0.14.2' } } apply plugin: 'com.android.application' repositories { jcenter() } android { c

这是我的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.
有什么想法吗?

你有代理人吗? 如果是,请检查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代理,您可以尝试设置。或者像这样在android studio我在intellij工作。但为什么有必要呢?由于VPN现在已关闭,除非您已将gradle配置为在没有活动连接的情况下工作,否则只需要连接到internet。