2017-02-16 90 views
1

我试图添加一个库到我的Android项目。我得到了一个错误:Gradle和Android:无法解决依赖关系com.android.support

Failed to resolve: com.github.Kunzisoft:AndroidClearChroma:1.6

所以我在allprojects添加maven { url "https://jitpack.io" }repositories。现在以前的错误消失了,但我有新的意外错误:

Error:FAILURE: Build failed with an exception. 

What went wrong: 
A problem occurred configuring project ':app'. 
> Could not resolve all dependencies for configuration ':app:_debugApkCopy'. 
    > Could not find com.android.support:appcompat-v7:25.1.1. 
    Required by: 
     project :app 
     project :app > com.android.support:design:25.1.0 
    > Could not find com.android.support:support-annotations:25.1.1. 
    Required by: 
     project :app > com.android.support:recyclerview-v7:25.1.0 
     project :app > com.android.support:design:25.1.0 > com.android.support:transition:25.1.0 
     project :app > com.android.support:recyclerview-v7:25.1.0 > com.android.support:support-compat:25.1.0 
     project :app > com.android.support:recyclerview-v7:25.1.0 > com.android.support:support-core-ui:25.1.0 
     project :app > com.android.support:design:25.1.0 > com.android.support:support-v4:25.1.0 > com.android.support:support-media-compat:25.1.0 
     project :app > com.android.support:design:25.1.0 > com.android.support:support-v4:25.1.0 > com.android.support:support-core-utils:25.1.0 
    > Could not find com.android.support:appcompat-v7:25.1.1. 
    Required by: 
     project :app > com.github.Kunzisoft:AndroidClearChroma:1.6 
    > Could not find com.android.support:preference-v7:25.1.1. 
    Required by: 
     project :app > com.github.Kunzisoft:AndroidClearChroma:1.6 
    > Could not find com.android.support:support-annotations:25.1.1. 
    Required by: 
     project :app > com.github.Kunzisoft:AndroidClearChroma:1.6 

Try: 
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output. 

似乎像Gradle找不到基本的Android库。我该如何解决它?

这是我的顶层的build.gradle:

// Top-level build file where you can add configuration options common to all sub-projects/modules. 
buildscript { 
    repositories { 
     jcenter() 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:2.2.3' 

     // NOTE: Do not place your application dependencies here; they belong 
     // in the individual module build.gradle files 
    } 
} 
allprojects { 
    repositories { 
     jcenter() 
     maven { url "https://jitpack.io" } 
    } 
} 
task clean(type: Delete) { 
    delete rootProject.buildDir 
} 

回答

3

谷歌的propriatory模块com.android.support*.*不能从公共Maven仓库。你必须从android-sdk-manager本地安装所需版本(你的情况是25.1.0或25.1.1)。