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 nativeActionBarImplementation
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>\IdeaProjectsOn
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
ModulesOn the left pane
- Click on the plus sign above the second column, and choose
Module
Add ModuleWindow will appear. Select Create
module from existing sourcesOption
- 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
librarySubdirectory
- Click
OKTo dismiss the Dialog
- Back in
Add ModuleWindow, clickNextAs
Faster times as needed
- Click
Finish
- Select your application module in
ModulesPane
- Activate
DependenciesTab, then click on the plus sign on the right, and selectModule
dependency...
- Select the ABS library and click
OK
- Finally click
OKTo closeProject
StructureWindow
Step 3: Add Android support library
- Copy the JAR File
<sdk>\extras\android\support\v4\android-support-v4.jarTo your
Project'slibsDirectory (create one if it doesn' t exist)
- Switch to idea
- Open
File > Project StructureIf you have closed it
- Select
LibrariesFrom 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
libsDirectory
- Choose the jar you copied earlier, and click
OK
- A popup titled
Choose ModulesWill appear
- Select both modules, and click
OK
- Click
OKTo apply the changes inProject
StructureWindow
Conclusion
That's it. You shoshould now be able to use actionbarsherlock in your project. Just don't forget to extendSherlockActivityClass
Instead of the nativeActivityClass. If anything goes wrong, let me know in
The comments.