How to configure actionbarsherlock with intellij idea [original URL: http://android-wtf.com/2012/09/how-to-configure-actionbarsherlock-with-intellij-idea/11211
Repliesintroduction
This tutorial will guide you through the steps to set up actionbarsherlock (ABS from
Now on) with your android project created using intellij idea. Just for the record,
I'm using ABS version 4.1.0 and idea version 11.1.3.
Requirements
- You must target API Level 14 (Android 4.0) or higher
- You must install the android support library using SDK manager, since ABS depends on it
As a rule, you shoshould always target the latest API version to avoid enabling unnecessary compatibility behaviors, to take advantage of the latest platform improvements and optimizations. abs, in turn, will use the platform's nativeActionBar
Implementation
Instead of it's own backport. As far as ABS is concerned, minimum SDK version can be as low as 7 (Android 2.1 ).
Step 1: Download actionbarsherlock
Download and extract actionbarsherlock, preferably to the same directory
Where your projects reside. By default, it isC:\Users\<Name>\IdeaProjects
On
Windows 7.
If you prefer git, clone and checkout the latest stable version.
Step 2: Create a module with intellij idea
- Switch to idea
- Open
File > Project Structure
- Select
Modules
On the left pane
- Click on the plus sign above the second column, and choose
Module
Add Module
Window will appear. Select Create
module from existing sources
Option
- Click on the button right next to the textbox
- A tree-based directory chooser dialog will pop up. Within the dialog navigate to the ABS directory, and choose
library
Subdirectory
- Click
OK
To dismiss the Dialog
- Back in
Add Module
Window, clickNext
As
Faster times as needed
- Click
Finish
- Select your application module in
Modules
Pane
- Activate
Dependencies
Tab, then click on the plus sign on the right, and selectModule
dependency...
- Select the ABS library and click
OK
- Finally click
OK
To closeProject
Structure
Window
Step 3: Add Android support library
- Copy the JAR File
<sdk>\extras\android\support\v4\android-support-v4.jar
To your
Project'slibs
Directory (create one if it doesn' t exist)
- Switch to idea
- Open
File > Project Structure
If you have closed it
- Select
Libraries
From the left pane
- Click on the plus sign above the second column, and choose
Java
- From the file-chooser popup, navigate to your project's
libs
Directory
- Choose the jar you copied earlier, and click
OK
- A popup titled
Choose Modules
Will appear
- Select both modules, and click
OK
- Click
OK
To apply the changes inProject
Structure
Window
Conclusion
That's it. You shoshould now be able to use actionbarsherlock in your project. Just don't forget to extendSherlockActivity
Class
Instead of the nativeActivity
Class. If anything goes wrong, let me know in
The comments.