Java Android Studio 找不到 com.android.support:support-v4:19.1.0
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23386545/
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 doesn't find com.android.support:support-v4:19.1.0
提问by Mazzy
I have imported one project into Android Studio
but I got the error:
我已经导入了一个项目,Android Studio
但出现错误:
Could not find com.android.support:support-v4:19.1.0.
找不到 com.android.support:support-v4:19.1.0。
Where could I find this file? I have imported the project using Gradle
.
我在哪里可以找到这个文件?我已经使用Gradle
.
I have the Android Studio version 0.5.7
the last android sdk and java 1.7u55
.
我有Android Studio version 0.5.7
最后一个 android sdk 和java 1.7u55
.
采纳答案by DK-x86
Just add this code to you build.gradlefile
只需将此代码添加到您的build.gradle文件中
dependencies {
compile 'com.android.support:support-v4:19.+'
}
and press Tools -> Android -> Sync Project with Gradle Files
然后按Tools -> Android -> Sync Project with Gradle Files
Gradle will download necessary files by himself
Gradle 会自己下载必要的文件
回答by CurlyPaul
I had this same problem with morning. I found the Jar file that I needed in /<MySdkFolder>/extras/android/support/
- in there are some sub folders with the different support libraries in them, so the last part of the path depends on which one that you want to use.
我早上遇到了同样的问题。我找到了我需要的 Jar 文件/<MySdkFolder>/extras/android/support/
- 其中有一些子文件夹,其中包含不同的支持库,因此路径的最后一部分取决于您要使用的那个。
I just copied this into the lib folder of the project. I'm sure there is a more technical solution but it worked for me.
我只是将其复制到项目的 lib 文件夹中。我确信有一个更具技术性的解决方案,但它对我有用。
回答by dfritsi
It does not work for me either. It works with 19.0.1 But if (I use gradle) I do this in my build.gradle:
它也不适合我。它适用于 19.0.1 但是如果(我使用 gradle)我在我的 build.gradle 中这样做:
repositories {
def androidHome = System.getenv("ANDROID_HOME")
mavenCentral()
maven {
url "$androidHome/extras/android/m2repository/"
}
}
It finds the artifact.
它找到了神器。
回答by xXJJJasonMokXx
Right clicking on the library and select the import as library option from the context menu works for me.
右键单击库并从上下文菜单中选择导入为库选项对我有用。
回答by nenick
Following theory works at me:
以下理论适用于我:
Android Studio has problems importing support-v4:19.1.+ library when it comes through a transitive dependency.
Android Studio 在通过传递依赖项导入 support-v4:19.1.+ 库时出现问题。
Solution Adding support-v4 as own dependency and exclude this lib where it comes transitive. then i could not more see this import issue
解决方案添加 support-v4 作为自己的依赖项,并在它传递的地方排除这个库。然后我看不到这个导入问题
回答by Derek
From the SDK Manager, delete and re-install the Android Support Library 19.1 package.
在 SDK 管理器中,删除并重新安装 Android Support Library 19.1 包。
回答by Max
Try to go
尝试去
Project Structure -> Dependencies -> Add : then select -> File dependecies
项目结构 -> 依赖项 -> 添加:然后选择 -> 文件依赖项
then select the proper library
然后选择合适的库