Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android-Tools Gradle Plugin

I am currently trying to get the new build system for android (http://tools.android.com/tech-docs/new-build-system/using-the-new-build-system) to work. Therefore I created a build.gradle file with the following contents:

apply plugin: 'android'

android {
    compileSdkVersion 15
    target='android-15'    

    defaultConfig {
        targetSdkVersion 15
        minSdkVersion 8
        versionCode 10
    }

    sourceSets {
        main {
            manifest {
                srcFile 'AndroidManifest.xml'
            }
        }
    }
}

repositories {
    mavenCentral()
}

dependencies {
    compile 'com.google.android:android:4.0.1.2'
    compile project(':ActionBarSherlock')
    compile fileTree(dir: './libs', include: '*.jar')
}

I've done this based on the docs, so I expect it to work; however, I get the following error message:

ERROR: The default configuration has an indirect dependency on Android API level 14, but minSdkVersion for variant 'Debug' is API level 8

When removing the explicit dependency on android 4.0.1.2, the error vanishes but I am left with compile errors because Android files themselves cannot be resolved. As an example, Activity or View as classes cannot be found. Supposedly, I could downgrade to an older version of Android to match the minSdkVersion, but I want to compile against sdk 15 with a minimum of 8.

The plugin itself is declared in a root build.gradle with version 0.3.

Has anyone of you got an idea how to resolve that error?

Thanks, Matthias

like image 725
user1050133 Avatar asked Mar 03 '13 09:03

user1050133


1 Answers

Hm somehow I got this to work using the support API instead of whole Android as dependency ... at least it works now ...

like image 163
user1050133 Avatar answered Nov 15 '22 13:11

user1050133