Android Actionbar How to Add Supporting Library V7 Appcompat for Eclipse

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

  1. Go to your project in the navigator, right click on properties.

  2. Go to the Java Build Path tab on the left.

  3. Go to the libraries tab on top.

  4. Click add external jars.

  5. Go to your ADT Bundle folder, go to sdk/extras/android/support/v7/appcompat/libs.

  6. Select the file android-support-v7-appcompat.jar

  7. Go to order and export and check the box next to your new jar.

  8. 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:

  1. Right click in your project folder, located in the Navigator.
  2. Click in properties, in the final of the list.
  3. In the Properties window, select the Android option (left menu).
  4. 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



Leave a reply



Submit