Android Studio认为我正在为API Level 1而不是Android L构建

Mow*_*Joe 7 android android-fragments android-studio android-5.0-lollipop

首先,我的应用程序的gradle.build:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 'android-L'
    buildToolsVersion '20.0.0'

    defaultConfig {
        applicationId "com.blah.blah"
        minSdkVersion 16
        targetSdkVersion 'L'
        versionCode 1
        versionName "alpha"
    }
    ...
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:support-v4:21.+'
    compile 'com.android.support:appcompat-v7:21.0.+'
    compile 'com.google.android.gms:play-services:5.0.77'
    compile 'com.koushikdutta.ion:ion:1.2.4'
}
Run Code Online (Sandbox Code Playgroud)

无论如何,我有一FragmentNavigationDrawer,自动生成由Android工作室,和所有的生命周期方法(onAttach(),onDetach(),onCreate(),等...)抛出的错误"这个方法不重写与当前构建目标什么,但我们将在API等级11(当前目标是1):".在Android Studio生成它之后,我没有触及片段的来源.这是为什么,我该如何解决这个问题?

alb*_*elu 1

确实,您在预览中需要 minSdkVersion 'L' 作为 Araks 点

但也有一个 bug,这里有一个解决方法 :Android L 上的 Fragments 出现 Lint 错误:“此方法不会覆盖任何内容”

刚刚发生在我身上,我的版本是正确的,正在寻找另一个解决方案......

编辑:Niek Haarman 使用 minSdkVersion 并表示: minSdkVersion 在构建时自动设置为“L”,以避免发布具有预览功能的应用程序。 在 L 预览中使用材质主题

有关解决方法的更多信息: http://www.reddit.com/r/androiddev/comments/2964nb/for_those_of_you_having_problems_building_with/