Importing Actionbarsherlock into eclipse

2019-02-05 07:23发布

问题:

Can someone tell me the steps on how to import the SherlockFragmentActivity.java and ActionBarSherlock folder correctly? I am not exactly sure how to do it and am getting many errors when trying.

回答1:

  1. Extract ActionBarSherlock project.
  2. Add the project in Eclipse like an android 4.0+ project.
  3. Then open you working project preferences and in Android section include de ActionBarSherlock project as library.
  4. Use what you need from ActionBarSherlock project.

You have a little tutorial on this site: tutorial



回答2:

  • Extract ActionBarSherlock
  • Open Eclipse and select File > Import
  • From there, select the library folder within the extracted ActionBarSherlock folder
  • Check "Copy projects into workspace"
  • Right click on the new project that should be named "library" go to Android Tools > Add Support Library
  • Follow those steps and you should be all set!

One thing you should pay attention to is the console. You might get permission issues if your Android SDK is installed in Program Files (x86). What you would need to do is then make sure you change the permissions so that apps can alter that folder. I know I had that problem and it took me forever to find because I didn't pay attention to the console.



回答3:

You get errors because you already have android-support-v4.jar in the /libs/ directory of your project, but the ActionBarSherlock project already includes this library and so a conflict occurs.

To fix this delete android-support-v4.jar from your project then go to Project > Clean.



回答4:

Follow the steps below and i am 100% sure that you will be successful in importing the android Action Bar Sherlock library.

  1. The first thing you have to do, is to download the library from http://actionbarsherlock.com? . After this unzip/untar it.

  2. The folder that you get will contain a number of sub-folders and files. Your action bar sherlock library is in the folder “actionbarsherlock”. Now, rename the folder “actionbarsherlock” to “ActionBarSherlockLib”.

  3. Now go to Eclipse and add the ABS(Action Bar Sherlock )-library as an Android project. Do not use Eclipse’s import tool to import the ActionBarSherlock library – it would not work immediately and you would have to fix some settings. Instead, create a new project as explained in the next step.

  4. Open File -> New -> Project -> Android Project From Existing Code. Select this and click next.

  5. In the next screen eclipse will ask you to browse the root directory. You have to select the root folder which contains all the files and folders that you had initially unzipped. After selecting the correct root folder, eclipse suggests a list of projects to create.

  6. You have to only check “ActionBarSherlockLib” and uncheck the rest.

  7. Check 'copy projects into workspace' and click finish.

  8. You are now a champion and have successfully imported the action bar sherlock library into eclipse. Congrats.