为什么gradle说不能解析"com.android.support:support-annotations:23.1.1"?

Why does gradle say that it cannot resolve "com.android.support:support-annotations:23.1.1"?

我正在构建一个名为 Shaking 的应用程序。今天在项目中添加了一些按钮库,即:

Bootstrap 按钮:https://android-arsenal.com/details/1/65

平面按钮:https://android-arsenal.com/details/1/68

我在 build.gradle 文件的 dependencies 块中添加了以下内容:

compile 'com.beardedhen:androidbootstrap:2.0.1' //This is the bootstrap library
compile 'info.hoang8f:fbutton:1.0.5' //This is the flat buttons library

就像上面的网页所说的那样

然后弹出一个错误提示:

Error:Failed to resolve: com.android.support:support-annotations:23.1.1

一段时间后,我发现问题是 bootstrap 按钮库引起的,因为如果我注释掉该行,就没有错误!

我试过关闭 Android Studio 并再次打开它并清理项目、重建...都没有用。

然后我发现了这个question
我认为我遇到的问题与此非常相似,所以我按照第二个答案建议的步骤进行操作。这次又出现了一个错误:

Error:failed to find target android-23 : C:\Users\User\AppData\Local\Android\sdk

我想我没有安装 SDK 23。

我真的很想知道为什么会这样,我该如何解决!

下面是com.beardedhen的build.gradle:androidbootstrap:2.0.1:

apply plugin: 'com.android.library'
apply from: 'push.gradle'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
        minSdkVersion 11
        targetSdkVersion 23
        versionCode = Integer.parseInt(VERSION_CODE)
        versionName = VERSION_NAME
    }
}

dependencies {
    compile 'com.android.support:support-annotations:23.1.1'
}

可以看到编译'com.android.support:support-annotations:23.1.1'.

确保您已安装 android 支持库 23.1.1:

在 build.grade 模块应用中添加:

实现组:'com.beardedhen',名称:'androidbootstrap',版本:'2.3.2'