Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android studio Gradle :: dependencies {compile 'com.android.support:appcompat-v7:18.0.0' } fails compilation

I recently switched to android studio for development. I had created project with minsdk,targetsdk and compile with sdk as Google Api Level 8.

The project compilation fails due to following code in build.gradle file.

dependencies {
    compile 'com.android.support:appcompat-v7:18.0.0'
}

Can anyone tell why this is hapenning?

My whole build.gradle is posted below.

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.5.+'
    }
}
apply plugin: 'android'

repositories {
    mavenCentral()
}

android {
    compileSdkVersion 8
    buildToolsVersion "18.1.0"

    defaultConfig {
        minSdkVersion 8
        targetSdkVersion 8
    }
}

dependencies {
        compile 'com.android.support:appcompat-v7:18.0.0'
    }

Below is the screenshot enter image description here

like image 971
Ashwin N Bhanushali Avatar asked Dec 11 '22 10:12

Ashwin N Bhanushali


1 Answers

You can't compile against any API below 11 and use the AppCompat library. It references the Holo style and the compiler will have no way to resolve those symbols if you're building against an old version.

Get rid of the problem by building against API level 18. This won't break the app for older devices, but you will need to heed the lint API warnings to ensure compatibility. You may have to re-sync the IDE with the gradle files by clicking the gradle icon on the menu bar.

like image 156
Krylez Avatar answered Dec 21 '22 10:12

Krylez