Android-Tools Gradle Plugin

2019-06-20 08:31发布

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

1条回答
劳资没心,怎么记你
2楼-- · 2019-06-20 08:45

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

查看更多
登录 后发表回答