2017-03-16 171 views
0

我使用的MPAndroidChart繪製在我的Android應用程序圖。我在做雷達圖,餅圖和線圖。我的問題是雷達圖需要不同版本的這個庫,這對其他兩個地塊不起作用。Android Studio中的build.gradle編譯錯誤

dependencies { 
compile fileTree(dir: 'libs', include: ['*.jar']) 
testCompile 'junit:junit:4.12' 
compile 'com.android.support:appcompat-v7:24.2.0' 
compile 'com.android.support:support-v4:24.2.0' 

compile 'com.github.PhilJay:MPAndroidChart:v3.0.1' 

compile 'com.github.PhilJay:MPAndroidChart:v2.1.6' 


} 

正如你可以看到我的依賴我編譯兩個不同的版本。這會導致錯誤,只有其中一個會起作用,因此雷達圖不會工作,否則其他兩個將不起作用。

有誰知道我可以編譯同一個庫的兩個版本?

回答

0

要下載同一個庫的多個版本:

repositories { 
    mavenCentral() 
} 

configurations { 
    compile5 
    compile6 
} 

dependencies { 
    compile5 'org.osgi:org.osgi.core:5.0.0' 
    compile6 'org.osgi:org.osgi.core:6.0.0' 
} 

task libs(type: Sync) { 
    from configurations.compile5 
    from configurations.compile6 
    into "$buildDir/libs" 
} 

您可以檢查 How to get Multiple Versions of the same library

0

major changes在V3.0.0 VS 2.x.x. MPCharts

我想你會過得更好使用最新的磁帶庫和調整那些不能正常工作的兩個圖表。