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

14,634

Solution 1

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.

Solution 2

Open "Android SDK Manager"

Install "Extra/Android Support Repository"

Share:
14,634

Related videos on Youtube

Ashwin N Bhanushali
Author by

Ashwin N Bhanushali

Having profound knowledge in Software architecture and Development. Specialised in Architecting Mobile applications. Have a sound knowledge of various Programming languages(java,scala,javascript,c#,swift),Software Development Methodologies(Waterfall--Agile),Programming Paradigms(OOP,functional) and Programming styles(Procedural,Reactive).

Updated on September 15, 2022

Comments

  • Ashwin N Bhanushali
    Ashwin N Bhanushali over 1 year

    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

    • Gabriele Mariotti
      Gabriele Mariotti over 10 years
      Have you updated Android Support Repository and Android Support Library in your SDK Manager?
  • Vincent Vieira
    Vincent Vieira about 10 years
    Thanks, that helped me a lot !