使用HTTP作为默认的IntelliJ或Android工作室

使用HTTP作为默认的IntelliJ或Android工作室

本文介绍了使用HTTP作为默认的IntelliJ或Android工作室的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这可能看起来像一个奇怪的要求(这可能有助于解释为什么没有谷歌的研究帮助我找到答案),但由于一些防火墙问题,通过HTTPS连接到外部资源需要很长的时间或超时完全

目前我的依赖关系是这样的:

  {相关性
    编译文件树(包括:['的* .jar'],DIR:库)
    编译com.android.support:appcompat-v7:22.2.0
    编译com.android.support:support-v4:22.2.0
    编译com.squareup.picasso:毕加索:2.5.2
    编译com.google code.gson:GSON:2.3.1
    编译com.mcxiaoke.volley:库:1.0.18
}

和我的错误困境如下:

 错误:发生了配置工程:应用程序。
>无法解析配置所有的依赖:应用程序:_debugCompile。
   >无法解析com.mcxiaoke.volley:库:1.0.18。
     要求:
         udacity-Android的纳米级​​ - july2015-PROJECT1:应用程序:未指定
      >不能让'https://jcenter.bintray.com/com/mcxiaoke/volley/library/1.0.18/library-1.0.18.pom。
         >连接https://jcenter.bintray.com拒绝
      >不能让'https://repo1.maven.org/maven2/com/mcxiaoke/volley/library/1.0.18/library-1.0.18.pom。
         >连接https://repo1.maven.org拒绝

现在,这些错误来来去去,真正依赖考虑它的时间对HTTPS请求骨干防火墙上。如果你在错误看上去很近,它引用 https://jcenter.bintray.com/com/mcxiaoke/volley/library/1.0.18/library-1.0.18.pom 时,你带哪,出了 HTTPS 和刚 HTTP 它揭示了同样的东西取代它。

对于需要以安全连接,HTTPS由于安全/登录/等,其优良的,但下载公共图书馆和依赖,我该如何确保Android Studio中坚持与普通HTTP

解决方案

嗯,我想我找到我的答案。我只需要更新的gradle我的剧本我的库指令来迫使它HTTP:

  {库
    行家{
        网址http://repo1.maven.org/maven2
    }
}

在这只是 mavenCentral()其中大部分已基于HTTPS

I know this may seem like an odd request (which may help explain why no google research is helping me find the answer) but due to some firewall issues, connecting to external resources via HTTPS takes a very long time or times out entirely.

Currently my dependencies look like:

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:appcompat-v7:22.2.0'
    compile 'com.android.support:support-v4:22.2.0'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.google.code.gson:gson:2.3.1'
    compile 'com.mcxiaoke.volley:library:1.0.18'
}

And my error woes look like:

Error:A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
   > Could not resolve com.mcxiaoke.volley:library:1.0.18.
     Required by:
         udacity-android-nanodegree--july2015-project1:app:unspecified
      > Could not GET 'https://jcenter.bintray.com/com/mcxiaoke/volley/library/1.0.18/library-1.0.18.pom'.
         > Connection to https://jcenter.bintray.com refused
      > Could not GET 'https://repo1.maven.org/maven2/com/mcxiaoke/volley/library/1.0.18/library-1.0.18.pom'.
         > Connection to https://repo1.maven.org refused

Now, these errors come and go and really depend on the backbone firewall taking its time on the HTTPS requests. If you look close at the error, it references https://jcenter.bintray.com/com/mcxiaoke/volley/library/1.0.18/library-1.0.18.pom which, when you strip out the https and replace it with just http it reveals the same thing.

For connections that need to be secure, HTTPS due to security/logins/etc, its fine, but for downloading public libraries and dependencies, how do I ensure Android Studio sticks with regular HTTP?

解决方案

Hmm I think I found my answer. I just need to update my repositories instructions in my gradle script to force it to HTTP:

repositories {
    maven {
        url "http://repo1.maven.org/maven2"
    }
}

before it was just mavenCentral() which much have been HTTPS based

这篇关于使用HTTP作为默认的IntelliJ或Android工作室的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-25 14:28