Failed to compile my Android project

When I try to compile my iroid project iam, getting the following error.

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

  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 someone help me fix this thanks.

+6
source share
3 answers

This is because 21.0.1 for support libraries does not exist .

You can use one of the following in 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 goes for com.android.support:recyclerview-v7

+7
source

I ran into a similar problem and installed the SDK build tools for Android -v23.0.1 and sent the Android setup guide https://facebook.imtqy.com/react-native/docs/android-setup.html#content

but could not find the "Android support repository", for the latest version of the SDK manager - the parameter is changed to "Local maven repository for support libraries".

enter image description here

+8
source

I think the line buildToolsVersion "23.0.0 rc2" is causing the problem.

change it to 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 said is correct too, maybe you are missing build tools

+1
source

All Articles