Reputation: 788
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?
Upvotes: 7
Views: 907
Reputation: 7971
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/
Upvotes: 1
Reputation: 41098
first of all: are you running the latest Android Studio version (0.8.2)?
Secondly, when you want to build an app for Android L Developer Preview you must set the following values in your gradle.build file:
compileSdkVersion 'android-L'
minSdkVersion 'L'
targetSdkVersion 'L'
So, fix your minSdkVersion!
Source: https://developer.android.com/preview/setup-sdk.html#createProject
Upvotes: 1