All Products
Search
Document Center

Mobile Testing - Deprecated:FAILED_OLDER_SDK

Last Updated:Feb 28, 2022

This error occurs when the APK file is compiled by using later-version SDK but the device has an earlier version.

You can view the value of android:minSdkVersion in the AndroidManifest.xml file.

With the continuous version update of the Android system, a crash may occur if later-version APIs are used in earlier-version devices.

If the minSdkVersion value is too low, the "Call requires API level (current Min is )" message will be reported when the build script is executed.

Although you can add the @SuppressLint("NewApi") or @ TargetApi($API_LEVEL) annotation to make a successful compilation, a crash still occurs during runtime.

To make the APK file compatible with earlier versions, you must determine the runtime version and do not invoke this method in the earlier-version system. To ensure the integrity of the feature, the earlier version implementation must be provided. You can execute the following code to determine the SDK version (a natural number):

int currentapiVersion = android.os.Build.VERSION.SDK_INT; 
if (currentapiVersion >= android.os.Build.VERSION_CODES.FROYO) {
     // Use the later-version API. 
} else {
     // Use the earlier-version API. 
}