[英]Android Studio doesn't find com.android.support:support-v4:19.1.0
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
。
Just add this code to you build.gradle file 只需将此代码添加到build.gradle文件即可
dependencies {
compile 'com.android.support:support-v4:19.+'
}
and press Tools -> Android -> Sync Project with Gradle Files 然后按工具 - > Android - >使用Gradle文件同步项目
Gradle will download necessary files by himself Gradle将自己下载必要的文件
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. 它找到了神器。
从SDK Manager中,删除并重新安装Android Support Library 19.1软件包。
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. 我在/<MySdkFolder>/extras/android/support/
- 中找到了我需要的Jar文件,其中有一些子文件夹中包含不同的支持库,所以路径的最后一部分取决于你想要的那个采用。
I just copied this into the lib folder of the project. 我只是将它复制到项目的lib文件夹中。 I'm sure there is a more technical solution but it worked for me. 我确信有一个更技术性的解决方案,但它对我有用。
右键单击库并从上下文菜单中选择导入为库选项适合我。
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. 解决方案将support-v4添加为自己的依赖项,并将此lib排除在可传递的位置。 then i could not more see this import issue 然后我再也看不到这个导入问题了
Try to go 试着去
Project Structure -> Dependencies -> Add : then select -> File dependecies 项目结构 - >依赖项 - >添加:然后选择 - >文件依赖项
then select the proper library 然后选择合适的库
This artifact is available on google maven repository .此工件可在google maven 存储库中找到。 So need to add following in the build.gradle:所以需要在build.gradle中添加如下内容:
allprojects {
repositories {
mavenLocal()
google()
}
}
I had a similar problem.我有一个类似的问题。 This line to build.gradle works --> implementation 'com.android.support:support v4:28.0.0'此行到 build.gradle 有效 --> 实施 'com.android.support:support v4:28.0.0'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.