Not targeting the latest versions of Android

I have a warning when trying to test theme on latest Android SDK Package 4.2.

Here is my manifest file:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.themetest"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="16" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppBaseTheme" >
        <activity
            android:name="com.example.themetest.MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

Not targeting the latest versions of Android; compatibility modes apply. Consider testing and updating this version. Consult the android.os.Build.VERSION_CODES javadoc for details. AndroidManifest.xml /ThemeTest line 7 Android Lint Problem

I am using a custom theme called 'AppBaseTheme'. My question is what exactly Consult the android.os.Build.VERSION_CODES javadoc.. How could I solve this problem?


It says this because of targetSdkVersion="16". API 16 is Jellybean 4.1 and 4.1.1, while Jellybean 4.2 is API 17.

Try using:

<uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="17" />

Also, keep in mind that this is a Lint warning. These warning exist to help you better your code and make it easy to maintain, while being compatible with the latest Android changes. Ignoring this will not cause you any immediate problems.

EDIT: With Android 4.3, the latest SDK version is now 18, so you should use:

...
        android:targetSdkVersion="18" />

EDIT 2: With Android 4.4, the latest SDK version is now 19, so you should use:

...
        android:targetSdkVersion="19" />

EDIT 3: With Android L, you must use the following values, as described here:

compileSdkVersion="android-L"
minSdkVersion="L"
targetSdkVersion="L"

EDIT 4: With Android L's public release, you must use 21 instead:

...
        android:targetSdkVersion="21" />

20 was used for 4.4W, or for Android Wear.

EDIT 5: With Android M's public release, you must use 23 instead:

...
        android:targetSdkVersion="23" />

In the future please consult the official Android documentation to keep yourself up-to-date with the latest Android API Levels.


You should not use android:maxSdkVersion="17" because it means that if someone using your app updates its android OS to a version greater than 17, your app will be removed.