MPAndroidChart的Gradle依赖性在Android Studio中不起作用

Kon*_*ert 2 gradle android-studio android-gradle-plugin mpandroidchart jitpack

尝试安装MPAndroidChart时,我尝试按照自述文件中的说明将库添加为gradle依赖项。

编辑:我没有编辑顶级build.grade文件,只有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'
}
Run Code Online (Sandbox Code Playgroud)

如您所见,我在依赖项中添加了maven存储库和compile指令。

但是,Android Studio给我一个错误:

Error:(32, 13) Failed to resolve: com.github.PhilJay:MPAndroidChart:v2.2.3
Run Code Online (Sandbox Code Playgroud)

编辑:这是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
Run Code Online (Sandbox Code Playgroud)

这是更好的线索,可以很容易地被谷歌搜索。

Mou*_*ssi 5

请像这样编辑您的顶级gradle文件:

allprojects {
repositories {
    jcenter()
    maven { url "https://jitpack.io" }
}
}
Run Code Online (Sandbox Code Playgroud)

另一件事..看看android studio右下角的gradle控制台,并向我显示日志。