Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio thinks I'm building for API Level 1 instead of Android L

First things first, my app's 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'
}

Anyway, I have a Fragment for a NavigationDrawer, auto-generated by Android Studio, and all of the lifecycle methods (onAttach(), onDetach(), onCreate(), etc...) throw the error "This method is not overriding anything with the current build target, but will in API level 11 (current target is 1):". I have not touched the source for the fragment after Android Studio generated it. Why is this, and how can I fix this?

like image 353
MowDownJoe Avatar asked Jul 06 '14 13:07

MowDownJoe


1 Answers

It's true that you need minSdkVersion 'L' in preview as Araks points

but tt s a bug too, here a workaround Lint error with Fragments on Android L: "This method is not overriding anything"

Just happened me and my version is correct, looking for another solution...

Edited: Niek Haarman uses minSdkVersion and says: The minSdkVersion is set to 'L' automatically when building, to avoid releasing apps with preview features. Using Material theme on L preview

Further information about the workaround: http://www.reddit.com/r/androiddev/comments/2964nb/for_those_of_you_having_problems_building_with/

like image 94
albodelu Avatar answered Nov 13 '22 03:11

albodelu