3

Pleas help with this error cause it's my first android project ! Gradle Sync: pply plugin: 'com.android.application'

android {
    compileSdkVersion 8
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.example.interceptor.myapplication"
        minSdkVersion 5
        targetSdkVersion 8
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:8.0.+'

}

On Gradle console i get: FAILURE: Build failed with an exception.

  • What went wrong: A problem occurred configuring project ':app'.

    Could not resolve all dependencies for configuration ':app:_debugCompile'. Could not find any version that matches com.android.support:appcompat-v7:8.0.+. Versions that do not match: 24.0.0-alpha1 23.2.1 23.2.0 23.1.1 23.1.0 + 14 more Searched in the following locations: https://jcenter.bintray.com/com/android/support/appcompat-v7/maven-metadata.xml https://jcenter.bintray.com/com/android/support/appcompat-v7/ file:/D:/Users/INTERCEPTOR/AppData/Local/Android/sdk/extras/android/m2repository/com/android/support/appcompat-v7/maven-metadata.xml file:/D:/Users/INTERCEPTOR/AppData/Local/Android/sdk/extras/google/m2repository/com/android/support/appcompat-v7/maven-metadata.xml file:/D:/Users/INTERCEPTOR/AppData/Local/Android/sdk/extras/google/m2repository/com/android/support/appcompat-v7/ Required by: MyApplication:app:unspecified

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

ELITE
  • 5,815
  • 3
  • 19
  • 29
JOHNNY T
  • 53
  • 2
  • 6

1 Answers1

4

You should use the correct version for the appcompat-v7 dependency.

The latest stable version of the above-mentioned dependency to now is:

    compile 'com.android.support:appcompat-v7:23.2.1'

Use it as above and make sure you installed/updated to the latest version in SDK Manager before.

Shayan Amani
  • 5,787
  • 1
  • 39
  • 40
  • compile version was established by default when i started the project! I'm trying to make an android app for android 2.2 + if it matters... But still thanks for solution! – JOHNNY T Mar 15 '16 at 07:52
  • 3
    Can't install 23.2.1. Studio package manager says it is downloaded, but Gradle says `Failed to resolve` – Konstantin Konopko Mar 24 '16 at 14:39
  • @konopko it could be helpful if you inform us about the error more than just `Failed to resolve` – Shayan Amani Mar 24 '16 at 14:45
  • @SHiON Gradle message: Failed to resolve: com.android.support:appcompat-v7:23.2.1. Package manager says it is installed, but I can't find it in SDK directory. – Konstantin Konopko Mar 24 '16 at 15:00
  • 1
    @konopko use standalone SDK Manager and clear its cache from Tools>Options, then reload it. Delete and reinstall android support library. – Shayan Amani Mar 24 '16 at 15:39
  • Gradle sucks. Projects wich compiles suddenly stopp Building for no apparent reason. Maven is so much more reliable. – Martin Mar 26 '16 at 11:27