java Android Studio Gradle 找不到“com.android.support:design:22.2.0”(Android 设计支持库)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/31755395/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-02 19:04:53  来源:igfitidea点击:

Android Studio Gradle cannot find 'com.android.support:design:22.2.0' (the Android Design Support Library)

javaandroidmavenandroid-studiogradle

提问by wayway

This issue has been incredibly frustrating for me for the past two weeks.

在过去的两周里,这个问题让我非常沮丧。

Using the Android SDK Manager, I updated the following:

使用 Android SDK 管理器,我更新了以下内容:

Tools:

Android SDK Tools rev. 24.3.3
Android SDK Platform-tools rev. 22
Android SDK Build-tools rev. 22.0.1

Android 5.1.1 (API 22):

SDK Platform rev. 2
Google APIs rev. 1
Sources for Android SDK rev. 1

Extras:

Android Support Repository rev. 16
Android Support Library rev. 22.2.1
Google Repository rev.22

This is the exact list of all the repositories that I've installed and updated to with the Android SDK Manager.

这是我使用 Android SDK 管理器安装和更新到的所有存储库的确切列表。

However, when I attempt to add the line:

但是,当我尝试添加该行时:

compile 'com.android.support:design:22.2.0'

Gradle becomes stuck on addDependecies. Furthermore, when I go to Module Settings, and then to Dependencies, when I try to add a new library, the 'com.android.support:design:22.2.0' does not appear within the list!

Gradle 卡在 addDependencies 上。此外,当我转到“模块设置”,然后转到“依赖项”时,当我尝试添加新库时,“com.android.support:design:22.2.0”不会出现在列表中!

Here's additional information about my target, compile, and minimum SDK version:

以下是有关我的目标、编译和最低 SDK 版本的附加信息:

android {
compileSdkVersion 22
buildToolsVersion '22.0.1'
defaultConfig {
    applicationId "com.myandroidapplication.newtestapp"
    minSdkVersion 14
    targetSdkVersion 22
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
productFlavors {
}
}

What could I possibly be missing at this point? Thank you!

此时我可能会遗漏什么?谢谢!

回答by Sharj

You have to use version 22.2.1 as it has installed on your computer.

您必须使用 22.2.1 版,因为它已安装在您的计算机上。

compile 'com.android.support:design:22.2.1'

回答by Prince Odame

For me, I was initially adding the support library dependency by typing it out in the build.gradle of my app directly. I cleaned the line that I had typed and added the dependency through the android studio GUI,

对我来说,我最初是通过直接在我的应用程序的 build.gradle 中键入来添加支持库依赖项的。我清理了我输入的行并通过 android studio GUI 添加了依赖项,

  1. Go to File
  2. Choose Project Structure
  3. Click on the Dependencies tab
  4. Click on the +symbol in the upper right conner and choose Library Dependency.
  5. Search for and add the support library in the dialog that appears
  6. Gradle build/sync should start automatically.
  1. 转到文件
  2. 选择项目结构
  3. 单击依赖项选项卡
  4. 单击右上角的+符号并选择 Library Dependency。
  5. 在出现的对话框中搜索并添加支持库
  6. Gradle 构建/同步应该自动启动。

Don't know why, but it works for me at least.

不知道为什么,但至少对我有用。