23

I'm getting a warning on my in the Manifest.

<uses-sdk> tag should specify a target API level (the highest verified version; 
when running on later versions, 
compatibility behaviors may be enabled) with android:targetSdkVersion="?"

What does this mean?

I've got

<uses-sdk
    android:minSdkVersion="7" />

In it at the moment. (Android 2.1)

1
  • 1
    Try removing the blank line. Make sure you have it placed in the proper location in the manifest. (inside the <manifest> tag, but NOT inside the <application> tag. And if that doesn't fix it, do a "Clean" of the project in Eclipse (I assume that's your dev environment).
    – Reed
    Mar 31, 2012 at 22:06

2 Answers 2

34

Just add the android:targetSdkVersion="8" attribute to the uses-sdk tag. If you just want to get rid of the warning, that will do it, safely.

If you want to know more, here's a description of what that attribute means,

http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#target

The docs are a little fuzzy, but what they say is that the target SDK version is used to determine if android should enable compatibility layers. for example, If your min SDK was 8, but your target SDK was 14, you are telling android that while there's no reason it shouldn't work on version 8, you've only tested on 14. Therefore, if there any compatibility settings to enable between level 8 and 14, they can be set. note that this attribute may actually do nothing depending on the actual min / target values.

If you set min SDK == target, you are essentially saying you have tested on the lowest API level you claim to support, which is a good thing.

2
  • Thanks, that got rid of it, but if targetSdkVersion="8" is in it, other versions can still use it correct?
    – Cole
    Mar 31, 2012 at 22:36
  • 1
    Uhm, isn't this the wrong way round? targetSdk == minSdk means that you have NOT tested on a newer version, which is a BAD thing. It also causes android to ENABLE compatibility behaviours that make newer versions (> targetSdk) behave more like the version specified in targetSdk to avoid confusing old apps.
    – wolfgang
    May 25, 2013 at 8:39
4

I have one walkaround solution.

  • Copy the manifest file, paste in your desktop.
  • Delete the manifest file in your project
  • Copy the manifest file from your desktop
  • And Paste in your project.

Worked for me as the warning disappeared.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.