2016-07-28 150 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」 「應用插件:‘行家’」