Android Studio build.gradle编译错误

问题描述 投票:0回答:2

我正在使用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'


}

正如您在我的依赖中所看到的,我编译了两个不同的版本。这会导致错误,只有其中一个会起作用,因此雷达图不起作用,否则其他两个不起作用。

有谁知道如何编译同一个库的两个版本?

android plot mpandroidchart
2个回答
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
投票

在v3.0.0和2.x.x中有major changes和MPCharts。

我认为你最好使用最新的库并调整两个不能正常工作的图表。

© www.soinside.com 2019 - 2024. All rights reserved.