❗️ NewApi error: Finds API accesses to APIs that are not supported in all targeted API versions
The above lint error message is displayed for your Android project when you use a method form an API that is not supported by all the Android APIs levels that you target.
Solution
You can either change the minSdkVersion and targetSdkVersion in your AndroidManifest.xml for unsupported APIs.
If you want to support all versions that you have stated in AndroidManifest then you need to use "Conditional execution" i.e. add conditions in your code based on the API level.
if (android.os.Build.VERSION.RELEASE.startsWith("2.") {
//Some code
}
else if (android.os.Build.VERSION.RELEASE.startsWith("3.") {
//Some code
}
else {
//Some code
}
You can also use @TargetApi annotation to set the SDK level to apply to your code, example
@TargetApi(18)
public class DoSomething {
//You Code
}
The above code will consider API level 18 rather than what is being defined in the AndroidManifest.xml file. But not that you cannot use @TargetApi for a method.
✌️ You can use tools:targetApi="" in the Android XML files to support certain API levels.
- Check Internet Connection WIFI 4G is active on Android Programmatically
- Android Emulator cannot be opened because the developer cannot be verified. [M1 Mac]
- How to Change Android Toast Position?
- Fail to connect to camera service Android java RuntimeException
- How to create Custom RatingBar Android Programming Tutorial
- Fixing Android unknown error 961 while downloading app
- Android AlertDialog with Yes No and Cancel Button
- Share or Send SMS via Android Intent
- The Android Virtual Device myEmulator is currently running an emulator and cannot be deleted.
- Pass data between two Android Activities and access it using Intent
- SQLite with Android Easy to Understand Tutorial that covers Select, Insert, Update and Delete
- [FIX] AndroidRuntime: FATAL EXCEPTION: main - java.lang.RuntimeException NullPointerException
- Android EditText Cursor Colour appears to be white
- Android Development - How to switch between two Activities
- Android xml error Attribute is missing the Android namespace prefix [Solution]
- Android : Remove ListView Separator/divider programmatically or using xml property
- Android is starting optimizing... app 1 of 1
- java.lang.NoClassDefFoundError android.support.v4.content.LocalBroadcastManager
- AlertDialog with single button example : Android
- Android : Exception raised during rendering: action_bar API 22
- Maven : java.lang.ClassNotFoundException: Xmx512m
- Android Lint app_name is not translated in af (Afrikaans) am (Amharic) ar (Arabic) bg (Bulgarian)
- Center align text in TextView Android Programming
- How to Download and Install Android adb Tool on Linux, Mac or Windows
- Multiline EditText in Android Example
- Configure AWS Access ID and Secret Keys using CLI on Mac - AWS
- [Solutions] Android Error in an XML file: aborting build. Eclipse SDK - Android
- How to connect to Microsoft Exchange Online using PowerShell - Powershell
- How to use Autocomplete and Autosuggestion in Shell Commands - Bash
- 16: Find the largest element in a List - 1000+ Python Programs - Python-Programs
- How to reset Eclipse IDE Code Font - Eclipse
- How to create SharePoint List Item programmatically using C#.net - SharePoint
- Docker MySQL Compose File with Volume Example - Docker