Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 627
Sathya Baman Avatar asked Sep 19 '15 06:09

Sathya Baman


People also ask

Why can't I run my project in Android Studio?

Clean and then rebuild your project. Make your project (it should work by now) Check your dependencies in gradle. At the very end you can try invalidating the cache and restarting (Recommended)

Where is compiler error output Android Studio?

Go to File > Settings > Build, Execution, Deployment > Compiler.


2 Answers

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

like image 69
Gabriele Mariotti Avatar answered Oct 22 '22 20:10

Gabriele Mariotti


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

like image 31
Aquib Vadsaria Avatar answered Oct 22 '22 19:10

Aquib Vadsaria