[英]Unable to compile my android project
When i try to compile my android project iam getting the following error. 当我尝试编译我的Android项目时,我收到以下错误。
Error:A problem occurred configuring project ':app'.
Could not resolve all dependencies for configuration ':app:_debugCompile'.
Could not find com.android.support:appcompat-v7:21.0.1.
Searched in the following locations:
https://jcenter.bintray.com/com/android/support/appcompat-v7/21.0.1/appcompat-v7-21.0.1.pom
https://jcenter.bintray.com/com/android/support/appcompat-v7/21.0.1/appcompat-v7-21.0.1.jar
file:/home/baman/Android/Sdk/extras/android/m2repository/com/android/support/appcompat-v7/21.0.1/appcompat-v7-21.0.1.pom
file:/home/baman/Android/Sdk/extras/android/m2repository/com/android/support/appcompat-v7/21.0.1/appcompat-v7-21.0.1.jar
file:/home/baman/Android/Sdk/extras/google/m2repository/com/android/support/appcompat-v7/21.0.1/appcompat-v7-21.0.1.pom
file:/home/baman/Android/Sdk/extras/google/m2repository/com/android/support/appcompat-v7/21.0.1/appcompat-v7-21.0.1.jar
Required by:
SriLankaTemples:app:unspecified
Could not find com.android.support:recyclerview-v7:21.0.1.
Searched in the following locations:
https://jcenter.bintray.com/com/android/support/recyclerview-v7/21.0.1/recyclerview-v7-21.0.1.pom
https://jcenter.bintray.com/com/android/support/recyclerview-v7/21.0.1/recyclerview-v7-21.0.1.jar
file:/home/baman/Android/Sdk/extras/android/m2repository/com/android/support/recyclerview-v7/21.0.1/recyclerview-v7-21.0.1.pom
file:/home/baman/Android/Sdk/extras/android/m2repository/com/android/support/recyclerview-v7/21.0.1/recyclerview-v7-21.0.1.jar
file:/home/baman/Android/Sdk/extras/google/m2repository/com/android/support/recyclerview-v7/21.0.1/recyclerview-v7-21.0.1.pom
file:/home/baman/Android/Sdk/extras/google/m2repository/com/android/support/recyclerview-v7/21.0.1/recyclerview-v7-21.0.1.jar
Required by:
SriLankaTemples:app:unspecified
Here is my Gradle file 这是我的Gradle文件
apply plugin: 'com.android.application'
android {
compileSdkVersion 19
buildToolsVersion "23.0.0 rc2"
defaultConfig {
applicationId "lk.lankahomes.baman.srilankatemples"
minSdkVersion 16
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:21.0.1'
compile 'com.android.support:recyclerview-v7:21.0.1'
}
can some one help me to fix this thank you. 有人可以帮我修复这个谢谢你。
It happens because the the 21.0.1 for support libraries doesn't exist . 这是因为支持库的21.0.1 不存在 。
You can use in build.gradle
one of these: 您可以在
build.gradle
使用build.gradle
其中一个:
dependencies{
//it requires compileSdkVersion 23
compile 'com.android.support:appcompat-v7:23.2.0'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:appcompat-v7:23.0.0'
//it requires compileSdkVersion 22
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.android.support:appcompat-v7:22.1.1'
compile 'com.android.support:appcompat-v7:22.1.0'
compile 'com.android.support:appcompat-v7:22.0.0'
//it requires compileSdkVersion 21
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.android.support:appcompat-v7:21.0.2'
compile 'com.android.support:appcompat-v7:21.0.0'
}
The same consideration is valid also for the com.android.support:recyclerview-v7
同样的考虑也适用于
com.android.support:recyclerview-v7
I faced similar issue and installed android SDK build tools -v23.0.1 and referred Android setup guide https://facebook.github.io/react-native/docs/android-setup.html#content 我遇到了类似的问题并安装了android SDK构建工具-v23.0.1并参考了Android安装指南https://facebook.github.io/react-native/docs/android-setup.html#content
but couldn't locate "Android support repository",for latest version of SDK manager- the option is changed to "Local maven repository for support libraries". 但无法找到“Android支持存储库”,对于最新版本的SDK管理器 - 该选项更改为“支持库的本地maven存储库”。
I think the buildToolsVersion "23.0.0 rc2"
line is causing the problem. 我认为
buildToolsVersion "23.0.0 rc2"
行导致了这个问题。
change it to buildToolsVersion "21.0.1"
将其更改为
buildToolsVersion "21.0.1"
or try 或尝试
compileSdkVersion 21
buildToolsVersion "22.0.1"
and 和
compile 'com.android.support:appcompat-v7:22.2.0'
and yes what sharj has said is also correct, you maybe missing the build tools 是的,sharj所说的也是正确的,你可能错过了构建工具
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.