Android Studio:找不到:'com.android.support:support-v4:19.1.0'
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24607741/
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
Android Studio: Failed to find: 'com.android.support:support-v4:19.1.0'
提问by MrHill
I want to build an app in Android Studio with the support library but I get the following error when adding the dependency for the support library:
我想使用支持库在 Android Studio 中构建一个应用程序,但是在为支持库添加依赖项时出现以下错误:
Error:Failed to find: com.android.support:support-v4:19.1.0
Here is my build.gradle file
这是我的 build.gradle 文件
apply plugin: 'com.android.application'
android {
compileSdkVersion 19
buildToolsVersion '20'
defaultConfig {
applicationId "sample.myapplication"
minSdkVersion 15
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v4:19.1.0'
}
I have downloaded the support library via the sdk manager.
我已经通过 sdk 管理器下载了支持库。
回答by MrHill
Ok, found the problem. The Android support repository was missing. After installing and restarting Android Studio it worked.
好的,发现问题了。缺少 Android 支持存储库。安装并重新启动 Android Studio 后,它工作正常。
回答by Patrick
If you are using Android Studio, then as an addition to changing the build.gradle file manually, you can also lookup the dependency via the library dependencies under the Project Structure menu item.
如果您使用的是 Android Studio,那么除了手动更改 build.gradle 文件之外,您还可以通过 Project Structure 菜单项下的库依赖项查找依赖项。
Double clicking that dependency will generate this line in build.gradle:
双击该依赖项将在 build.gradle 中生成这一行:
dependencies {
compile 'com.android.support:support-v13:+'
}
And also, if you are wondering what this library is about, it's described at the developer pages at developer.android.com; Support Library.
而且,如果您想知道这个库是关于什么的,可以在 developer.android.com 的开发者页面上进行描述;支持库。
回答by Allen
My Android Studio version is 1.1. I select tools
->Android
->SDK Manager
, check the Android Support Librarythen click Install packages
, solved this issue.
我的 Android Studio 版本是 1.1。我选择tools
-> Android
-> SDK Manager
,检查Android Support Library然后点击Install packages
,解决了这个问题。
回答by Tad
In my case the solution was as simple as running Build
:Make Project
. No amount of gradle syncing or clearing caches would do it. Of course, that required getting my project into a state where it would build successfully.
在我的情况下,解决方案就像运行Build
:一样简单Make Project
。没有多少 gradle 同步或清除缓存可以做到这一点。当然,这需要让我的项目进入可以成功构建的状态。
回答by Regys
In my case I needed to add Google Maven repository.
就我而言,我需要添加 Google Maven 存储库。
It shows as part of the error in Android Studio and only needed to click on it to add itself.
它在 Android Studio 中显示为错误的一部分,只需单击它即可添加自身。
Then Gradle built the project on its own.
然后 Gradle 自己构建了这个项目。
回答by natur3
Following the instruction here helped me. For whatever reason when I had to reinstall the latest version of android studio the initial download of the extras section android support library failed. I simply retried it. Followed the steps mentioned and verified it was added to the build.gradle file and did a rebuild project and good to go.
按照这里的说明帮助我。无论出于何种原因,当我不得不重新安装最新版本的 android studio 时,额外部分 android 支持库的初始下载失败。我只是重试了。遵循提到的步骤并验证它已添加到 build.gradle 文件中,并进行了重建项目,一切顺利。
http://developer.android.com/tools/support-library/setup.html
http://developer.android.com/tools/support-library/setup.html