简体   繁体   中英

Gradle and Android: Could not resolve dependencies com.android.support

I' m trying to add a library to my Android project. I was getting an error:

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

so I have added maven { url "https://jitpack.io" } to repositories in allprojects . Now the previous error is gone, but I have new, unexpected error:

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.

Seems like Gradle cannot find basic Android libraries. How can i fix it?

It's my top-level 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
}

the google propriatory modules com.android.support*.* are not available from public maven repositories. you have to install the required version (in your case 25.1.0 or 25.1.1) locally from android-sdk-manager.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM