Inspectopedia Help

Manually Edited TargetSdkVersion

Manually Edited TargetSdkVersion

Updating the targetSdkVersion of an app is seemingly easy: just increment the targetSdkVersion number in the manifest file!

But that's not actually safe. The targetSdkVersion controls a wide range of behaviors that change from release to release, and to update, you should carefully consult the documentation to see what has changed, how your app may need to adjust, and then of course, carefully test everything.

In new versions of Android Studio, there is a special migration assistant, available from the tools menu (and as a quickfix from this lint warning) which analyzes your specific app and filters the set of applicable migration steps to those needed for your app.

This lint check does something very simple: it just detects whether it looks like you've manually edited the targetSdkVersion field in a build.gradle file. Obviously, as part of doing the above careful steps, you may end up editing the value, which would trigger the check -- and it's safe to ignore it; this lint check only runs in the IDE, not from the command line; it's sole purpose to bring awareness to the (many) developers who haven't been aware of this issue and have just bumped the targetSdkVersion, recompiled, and uploaded their updated app to the Google Play Store, sometimes leading to crashes or other problems on newer devices.

Issue id: EditedTargetSdkVersion

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for Android 2023.3, Qodana for JVM 2023.3


Android, 2022.3.1 Beta 2

Last modified: 13 July 2023