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

First of all, my gradle.build application:

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 NavigationDrawer automatically generated by Android Studio, and all lifecycle methods ( onAttach() , onDetach() , onCreate() , etc.) throw an error "This method does not undo anything for the current purpose assembly, but will be in API level 11 (current target is 1): ". I did not touch the source for the fragment after Android Studio generated it. Why is this and how can I fix it?

+7
android android-5.0-lollipop android-studio android-fragments
source share
2 answers

It is true that you need minSdkVersion 'L' in preview mode, as Araks indicates

but tt is also an error, here is a workaround Lint error with fragments on Android L: "This method does not cancel anything"

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

Edited: Niek Haarman uses minSdkVersion and says: When building, minSdkVersion is automatically set to "L" to not release applications with preview functions. Using Material Theme When Previewing L

Additional workaround information: http://www.reddit.com/r/androiddev/comments/2964nb/for_those_of_you_having_problems_building_with/

+1
source share

first of all: do you use the latest version of Android Studio (0.8.2)?

Secondly, when you want to create an Android L Developer Preview application, you must set the following values ​​in the gradle.build file:

 compileSdkVersion 'android-L' minSdkVersion 'L' targetSdkVersion 'L' 

So fix minSdkVersion!

Source: https://developer.android.com/preview/setup-sdk.html#createProject

+1
source share

All Articles