2016-07-28 157 views
1

建筑时,Gradle给我Failed to resolve: com.github.PhilJay:MPAndroidChart:v2.2.4错误。无法解决:com.github.PhilJay.MPAndroidChart:v2.2.4

我已经在build.gradle添加jitpack这里:

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

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

allprojects { 
    repositories { 
     jcenter() 
     flatDir { 
      dirs 'aar' 
     } 
     maven { url "https://jitpack.io" } 
    } 
} 

task clean(type: Delete) { 
    delete rootProject.buildDir 
} 

这是基于here。我错过了什么?

+0

gradle控制台究竟说了些什么? – AndroidMechanic

+0

@AndroidMechanic它说'无法解决:com.github.PhilJay:MPAndroidChart:v2.2.4'并指向模块'build.gradle'在这一行:'编译'com.github.PhilJay:MPAndroidChart:v2.2.4 '' –

回答

0

切换到最新版本:

compile 'com.github.PhilJay:MPAndroidChart:v3.0.0-beta1' 

并始终使用为主要来源的信息 - 在这种情况下MPAndroidChart Github Repo Readme.MD

如果在代理中gradle.properties配置代理服务器设置如下:

systemProp.http.proxyHost=103.7.11.34 
systemProp.https.proxyPort=8080 
systemProp.https.proxyHost=103.7.11.34 
systemProp.http.proxyPort=8080 

注意: IP地址和端口在上面的行将被repl通过你的代理服务器的IP地址(或URL)和端口

+0

同样的事情。现在它说'无法解决:com.github.PhilJay:MPAndroidChart:v3.0.0-beta1'。有关于这个问题的jitpack问题吗? –

+0

你在代理服务器后面吗?如果是,请在gradle.properties文件中设置代理设置并尝试 – AndroidMechanic

+0

这仅仅是一个随机代理IP地址? –

-1

Did you add the following in your root build.gradle file: if not then add this.

repositories { 
    maven { url "https://jitpack.io" } 
} 

,并重新启动Android StudioRebuild项目一杆进洞。

我都面临着同样的问题,重新启动后android studio的问题解决了 - >rebuild project.

此外,如果没有上面您可以在gradle-wrapper.properties改变distributionUrlversion到可用newest解决。

+0

你可以直接指向现有的帖子而不是复制和粘贴答案和导致重复 - 上面的文本来源 - http://stackoverflow.com/questions/32718820/failed-to-resolve-com-github-philjaympandroidchartv2-1-4?noredirect=1&lq=1 – AndroidMechanic

0

请检查您是否在您的build.gradle中添加以下插件在其中添加
编译的扶养“com.github.PhilJay:MPAndroidChart:V2.2.4” “应用插件:‘行家’”