試圖安裝MPAndroidChart時,我試圖按照Readme中的說明將庫添加爲gradle依賴項。MPAndroidChart的Gradle依賴關係在Android Studio中不工作
編輯: 我沒有編輯我的應用程序目錄中的top-level build.grade
file,只有build.gradle
文件。後者是這樣的:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.0"
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.gmail.konstantin.schubert.workload"
minSdkVersion 16
targetSdkVersion 23
versionCode 7
versionName "1.1.5"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
maven { url "https://jitpack.io" }
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.google.guava:guava:17.0'
compile 'joda-time:joda-time:2.8.2'
compile 'com.android.support:design:23.0.0'
compile 'com.github.PhilJay:MPAndroidChart:v2.2.3'
}
正如你所看到的,我已經在依賴項中添加了maven倉庫和編譯指令。
不過,Android工作室給我一個錯誤:
Error:(32, 13) Failed to resolve: com.github.PhilJay:MPAndroidChart:v2.2.3
編輯:這裏是由JitPack給出的說明:https://jitpack.io/ 我相信我跟着他們的信。
我在做什麼錯?我忘了什麼?
編輯:問題是真的跟在錯誤的領導。看着我的gradle日誌,我發現了以下錯誤:
* What went wrong:
A problem occurred configuring project ':app'.
Could not resolve all dependencies for configuration ':app:_debugCompile'.
Could not resolve com.github.PhilJay:MPAndroidChart:v2.2.3.
Required by:
workload:app:unspecified
Could not GET 'https://jitpack.io/com/github/PhilJay/MPAndroidChart/v2.2.3/MPAndroidChart-v2.2.3.pom'.
> peer not authenticated
這是一個好得多的結果,可以很容易地被Google搜索到。
它現在說:你必須指定一個Maven倉庫的URL。 IDE說它不能解析符號'url'。你確定我需要'maven {maven {..}}'的雙重嵌套嗎?但即使我只是將'maven {url「https://jitpack.io」}'添加到頂層gradle文件中,它仍然不起作用。 –
請看看我的編輯答案,嘗試刪除maven的雙重嵌套..它在我的電腦上工作 –
正如我在我的評論中已經提到的,我也嘗試了這種配置,但它仍然給出了原始錯誤。 –