Why does Eclipse automatically add appcompat v7 library support whenever I create a new project?
As stated in Android's Support Library Overview, it is considered good practice to include the support library by default because of the large diversity of devices and the fragmentation that exists between the different versions of Android (and thus, of the provided APIs).
This is the reason why Android code templates tools included in Eclipse through the Android Development Tools (ADT)
integrate them by default.
I noted that you target API 15
in your sample, but the miminum required SDK for your package is API 10
, for which the compatibility libraries can provide a tremendous amount of backward compatible APIs. An example would be the ability of using the Fragment API
which appeard on API 11
(Android 3.0 Honeycomb) on a device that runs an older version of this system.
It is also to be noted that you can deactivate automatic inclusion of the Support Library by default.
Can't add support library v7 AppCompat
After i re-install eclipse, android SDK all works fine with support lib v7.
The Import android.support.v7 cannot be resolved
Go to your project in the navigator, right click on properties.
Go to the Java Build Path tab on the left.
Go to the libraries tab on top.
Click add external jars.
Go to your ADT Bundle folder, go to sdk/extras/android/support/v7/appcompat/libs.
Select the file android-support-v7-appcompat.jar
Go to order and export and check the box next to your new jar.
Click ok.
The import android.support.v7.app cannot be resolved
After you add appcompat_v7 to your dependencies, be sure that the libs
folder from your project are empty. By default, an android-support-v4.jar is created when you define your project, so this will cause conflict when you declare appcompat_v7 library as your dependency.
So, the first thing you need to do is check the folder .../My_Project/libs
and fearlessly delete the file android-support-v4.jar
.
Then, add the appcompat_v7 library as a dependency of your project:
To do this, if you are using Eclipse:
- Right click in your project folder, located in the Navigator.
- Click in properties, in the final of the list.
- In the Properties window, select the Android option (left menu).
- In the box Library, add your new reference.
If you are using Android Studio, you can follow the steps mentioned in the @Joey Garcia's comment.
Support Library Setup -
https://developer.android.com/tools/support-library/setup.html
Let me know if it helped you. Good Luck!
ActionBar in Android Maven Project using Android Support Library v7
Implement ActionBar in 2.2 device and other Functionlity like ViewPager,Framgmet Tag in 2.2 then there is two way using sherlockActionbar and AppCompat
Sherlock is and third party library while AppCompat is Android library.
step to use AppCompact in project
just update android skd-> extra-> Android support library
Then goto you sdk in your system-> Androidsdk\extras\android\support\v7 find appcompat source code. Import this appcompact in you eclipse.
Create you project and select appcompact library from property->android-> Library.
open you manifeast file and change theme **android:theme="@style/Theme.AppCompat.Light**"
Then extend your activity with ActionBarActivity
if you cannot found it then pls manualy import `
import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBar.Tab;
import android.support.v7.app.ActionBarActivity;`
Then Add below code to activity
final ActionBar actionBar = getSupportActionBar();
actionBar.setHomeButtonEnabled(false);
Related Topics
How to Display Image in Android's Textview
How to Move the Layout Up When the Soft Keyboard Is Shown Android
How to Take Camera Capture Without a Preview from a Service or Thread
Android - Get Time of Chronometer Widget
Android Material: Status Bar Color Won't Change
How to Draw a Route, Along an Existing Road, Between Two Points
Android Speech Recognition Continuous Service
How to Resolve "Waiting for Debugger" Message
How to Set Android_Sdk_Home Environment Variable
Error :: Duplicate Files During Packaging of APK
Get Cursor Position in Android in Edit Text
How to Use View.Ontouchlistener Instead of Onclick
Android Type_Linear_Acceleration Sensor - What Does It Show
How to Set Text in an Edittext
How to Style the Standard React-Native Android Picker
Android Broadcastreceiver, Auto Run Service After Reboot of Device