Tuesday 16 October 2012

Installing ActionBarSherlock with IntelliJ IDEA

I recently decided to start using ActionBarSherlock (ABS) on my Android project and ran into a minor issue when trying to add ABS to my Intellij IDEA project.

I initially followed the instructions here, however it didn't work. It may be that this was written for an earlier version of ABS and/or IDEA, but I got errors because IDEA was trying to build the ABS tests and complaining about junit being missing.

The solution is to make sure that the the 'test' directory is unticked when adding ABS module to your project.

The other issue with the instructions at the above link is that it assumes you haven't already installed android.support.v4.jar. If you have then there can be an issue if the version supplied with ABS is different to the version you already have installed. I replaced the version supplied with ABS with the latest version and made sure the 'export' checkbox in the dependancies tab (Project Structure->Modules) of ABS module was checked, then removed the android.support.v4.jar from my app module. This makes sure that both ABS and your app use the same support jar. You can then safely ignore the second part of the linked instructions.

For the record, this applies to ABS version 4.2 and Intellij IDEA 11.1.

2 comments:

  1. Thanks, this is exactly what I needed. I just deleted that folder and everything is okay ;)

    ReplyDelete
  2. THANK YOU!!!! I had toyed with this for nearly 3 hours trying to figure out where i was going wrong.

    I also had 'androidannotations-api-2.7.jar' within my 'libs' project folder [back from my Eclipse project] which was causing issues, once i followed your instructions and removed the androidannotations-api-2.7.jar from my libs folder, the project compiled successfully!

    Thanks again Andy, I owe you !

    ReplyDelete