在我的android應用程序中,我必須創建圖表,所以我喜歡使用MPAndroidCharts。我在v3.0.1上看到了最新版本,但是我可以在gradle上配置它正確。當我使用gradle配置時,出現了錯誤。如何在Gradle中配置MPAndroidChart:v3.0.1
Error:Gradle: A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
> Could not find com.github.PhilJay:MPAndroidChart:v3.0.1.
Searched in the following locations:
https://jcenter.bintray.com/com/github/PhilJay/MPAndroidChart/v3.0.1/MPAndroidChart-v3.0.1.pom
https://jcenter.bintray.com/com/github/PhilJay/MPAndroidChart/v3.0.1/MPAndroidChart-v3.0.1.jar
file:/usr/local/lib/android-sdk-linux/extras/android/m2repository/com/github/PhilJay/MPAndroidChart/v3.0.1/MPAndroidChart-v3.0.1.pom
file:/usr/local/lib/android-sdk-linux/extras/android/m2repository/com/github/PhilJay/MPAndroidChart/v3.0.1/MPAndroidChart-v3.0.1.jar
file:/usr/local/lib/android-sdk-linux/extras/google/m2repository/com/github/PhilJay/MPAndroidChart/v3.0.1/MPAndroidChart-v3.0.1.pom
file:/usr/local/lib/android-sdk-linux/extras/google/m2repository/com/github/PhilJay/MPAndroidChart/v3.0.1/MPAndroidChart-v3.0.1.jar
我做錯了什麼?以下是我的gradle配置。
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '23.0.2'
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.example.myproject"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
vectorDrawables.useSupportLibrary = true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_6
targetCompatibility JavaVersion.VERSION_1_6
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:design:23.2.0'
compile 'com.android.support:cardview-v7:23.2.0'
compile 'com.android.support:recyclerview-v7:23.2.0'
compile 'org.springframework.android:spring-android-rest-template:1.0.1.RELEASE'
compile('org.springframework.android:spring-android-auth:1.0.1.RELEASE') {
exclude module: 'spring-core'
}
compile 'org.springframework.android:spring-android-core:1.0.1.RELEASE'
compile 'org.apache.commons:commons-io:1.3.2'
compile 'com.github.PhilJay:MPAndroidChart:v3.0.1'
}
你可能缺少庫,在這裏可以gradle這個尋找的lib: 'allprojects { 知識庫{ maven {url「https://jitpack.io」} } }' –
@RomanKolomenskii我打算創建一個離線app.Does這會產生任何問題,如果沒有互聯網接入? – KJEjava48
不,它只下載它(jar文件)一次,當你同步你的項目 –