I get this error in Eclipse: Call requires API level 14 (current min is 8): android.app.ActionBar#setHomeButtonEnabled
This is code:
if(android.os.Build.VERSION.SDK_INT>=14) { getActionBar().setHomeButtonEnabled(false); }
In Manifest:
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="14" />
How to remove this error?
Step 1: Open your project in Android mode then go to Gradle Scripts > build. gradle(Module: app) as shown in the following image. Step 2: Refer to the below image and here you have to change the minSdkVersion and targetSdkVersion as per the requirement.
Declaring a minimum API Level This ensures that users will only be able to install your application if their devices are running a compatible version of the Android platform. In turn, this ensures that your application can function properly on their devices.
Starting in November 2022, app updates must target API level 31 or above and adjust for behavioral changes in Android 12; except for Wear OS apps, which must target API level 30 or higher.
@RequiresApi - Denotes that the annotated element should only be called on the given API level or higher. @TargetApi - Indicates that Lint should treat this type as targeting a given API level, no matter what the project target is.
Add the line @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
above the method signature, where Build.VERSION_CODES.ICE_CREAM_SANDWICH
evaluates to 14, the API version code for Ice Cream Sandwich.
Like so:
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH) public void yourMethod() { if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { getActionBar().setHomeButtonEnabled(false); } }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With