Android的工具插件摇篮摇篮、插件、工具、Android

2023-09-07 17:24:50 作者:人小鬼大

目前我正在试图获得新的构建系统为Android(http://tools.android.com/tech-docs/new-build-system/using-the-new-build-system) 。上班所以我创建了以下内容的的build.gradle 文件:

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:

错误:默认的配置对Android的间接依赖  API级别14,但为的minSdkVersion变种'调试'是API级别8

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

在删除在Android 4.0.1.2的显式依赖,错误消失,但我留下编译错误,因为Android的文件本身不能得到解决。作为一个例子,活动查看如类无法找到。按说,我可以降级到旧版Android匹配的minSdkVersion ,但我想编译反对SDK 15 用最少的 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.

插件本身是宣布根的build.gradle 0.3版本。

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

推荐答案

HM不知何故,我得到这个使用支持的API,而不是完整的Andr​​oid作为依赖工作......至少现在的工作......

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