I've used the below code in my application.
getActionBar().setHomeButtonEnabled(true);
I've set
android:minSdkVersion="11"
in my code. However, every time I edit my AndroidManifest.xml file, it gives an error.
Call requires API level 14 (current min is 11):android.app.ActionBar#setHomeButtonEnabled.
And error disappears after cleaning the project (in Eclipse).
Project -> Clean..
Is there a fix without having to clean the project everytime?
The ActionBar class was added in API level 11, but not the method your are using. If you look at the doc you'll see that setHomeButtonEnabled(boolean) was added in API level 14.
Yes, add action bar sherlock as a library. it allows you to work with API 8 and above.
https://github.com/JakeWharton/ActionBarSherlock
Also while using actionbarsherlock, the code should be :
getSupportActionBar().setHomeButtonEnabled(true);
Related
I am trying to create an android project and it gives me errors
and errors appear only if I have more than one android project (R cannot be resolved to a variable ) and if i import it errors change to (R.menu.main,R.layout.activity_main,R.id.action_settings
Change android:minSdkVersion to 11 in your androidmanifest.xml. Yours is currently 8 which does not allow the call your are trying to make in onCreateView() method. First error in your screenshot clearly says it.
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="23" />
target SDK could be what you want.
Based on your comment if you still want to continue using API level 8. You should determine the API level at runtime and then call the method that works for the Android version on device. Read this for more info: Check System Version at Runtime
appcompat(v7) library gets add up automatically when you are using a minimum API level for your application development. Why am I getting appcompat with API 11? I mean if its already included in API level 11 why does it add up then. Can and should I remove it?
I m creating a customised music player with some additional features in it.... for that i copied one project whose API level is 10 and pasted it in my current working project whose API level is 19..... i m getting an error "Using 1.7 requires compiling with Android 4.4 (KitKat); currently using API 10"...... I don't know how to make two API level work in the same project ..... please help....... i tried cleaning my project and rebuilding it ..... but after that it shows R cannot be resolved to a variable
Try changing the api level on the project, in your project manifest you will find this line:
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="19" />
Change the targetSdkVersion to 19 to make it work with Android 4.4.
When running my Android app I often get a list of errors, wich says
Class requires API level 3 (current min is 1): android.hardware.SensorEventListener
I've searched for the correct answer to this, like Android tools > Clear Link Markers, but this doesn't solve the problem. Every once in a while the list of errors keeps coming back. Is it something in my project settings or are my methods deprecated? I've installed the latest SDK for Android 4.4.
In your manifest file set the sdk like this based on your requirement..
<uses-sdk
android:maxSdkVersion="17"
android:minSdkVersion="8" />
Restart and invalidate cache if this error just started up for no apparent reason
Change your application minsdk from Preference>Android>select the api level Android1.6
I am attempting to set up ActionBarShelock for the first time using Eclipse on Windows 7.
I followed these instructions: http://actionbarsherlock.com/usage.html
ActionBarSherlock project.properties:
android.library=true
# Project target.
target=android-15
ActionBarSherlock AndroidManifest.xml:
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="11"/>
My error in Lint: Call requires API level 11 (current min is 7): android.widget...
Or if I ignore the error on ActionBarSherlock and import it as a library then I cannot compile my project because any references to the library are not recognized and I get no resource errors.
I looked up many people with similar problems and it was always an API build target error. Thank you for your suggestions!
A few things:
Make sure you are compiling your application with Android 4.0 or newer (API 14+). You must do this in addition to just the library.
Ensure you are calling getSupportActionBar rather than getActionBar. This is likely the source of your errors for lint.
While targeting API 11 is valid, many things are gained by targeting 14 or higher. Try to do that if you can.
I found it! The JDK compliance level was set to 1.5. After setting it to 1.6 it worked.
It says this right in the Action Bar Sherlock website in the requirements section but I made the error of assuming Eclipse was using the latest JDK settings.
Definite beginners mistake.
Thank you for your help.
Are you using an old version of ActionBarSherlock perhaps? As the current version, 4.1.0 has the targetSdk set to 15.
I think some older version can have a problem with newer ADT/lint or similar.