【问题标题】:Gradle and Android: Could not resolve dependencies com.android.supportGradle 和 Android:无法解析依赖项 com.android.support
【发布时间】:2017-02-16 10:54:48
【问题描述】:

我正在尝试向我的 Android 项目添加一个库。我收到一个错误:

无法解决: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
}

【问题讨论】:

    标签: java android maven gradle


    【解决方案1】:

    google 专有模块 com.android.support*.* 在公共 maven 存储库中不可用。您必须从 android-sdk-manager 本地安装所需的版本(在您的情况下为 25.1.0 或 25.1.1)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-12-19
      • 2013-12-12
      • 2018-03-06
      • 1970-01-01
      • 2016-06-17
      • 1970-01-01
      • 2015-03-03
      相关资源
      最近更新 更多