簡體   English   中英

Android Studio build.gradle編譯錯誤

[英]Android Studio build.gradle compile error

我正在使用MPAndroidChart在我的android應用程序中繪制圖形。 我正在做雷達圖,餅圖和折線圖。 我的問題是雷達圖需要該庫的其他版本,而該版本對其他兩個圖不起作用。

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'


}

如您所見,我編譯了兩個不同的版本。 這會導致錯誤,並且其中只有一個會起作用,因此雷達圖將不起作用,或者另外兩個將不起作用。

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

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

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"
}

您可以檢查如何獲取同一庫的多個版本

vChart在v3.0.0和2.xx中進行了重大更改

我認為您最好使用最新的庫並調整兩個無法正常工作的圖表。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM