Sathya Baman
Sathya Baman

Reputation: 3515

Unable to compile my android project

When i try to compile my android 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 some one help me to fix this thank you.

Upvotes: 6

Views: 19016

Answers (3)

Gabriele Mariotti
Gabriele Mariotti

Reputation: 364451

It happens because the the 21.0.1 for support libraries doesn't exist.

You can use in build.gradle one of these:

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

Upvotes: 7

Aquib Vadsaria
Aquib Vadsaria

Reputation: 350

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

but couldn't locate "Android support repository",for latest version of SDK manager- the option is changed to "Local maven repository for support libraries".

enter image description here

Upvotes: 7

penta
penta

Reputation: 2596

I think the buildToolsVersion "23.0.0 rc2" line 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 has said is also correct, you maybe missing the build tools

Upvotes: 1

Related Questions