artem
artem

Reputation: 16777

Failed to build ActionBarSherlock in IntelliJ IDEA

I had included the library module ActionBarSherlock to my project. Minimal SDK version is 10, target SDK - 13 for both the projects.

But when I'm trying to build the project, I'm getting a lot of errors like:

[Library] /Users/rankor777/src/ActionBarSherlock/library/res/values-v14/abs__styles.xml:4: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Holo.ActionBar'.

Why?

Upvotes: 2

Views: 3125

Answers (4)

Deniz
Deniz

Reputation: 1565

  • Download ActionBarSherlock zip file and extract it next to your application module which will make use of ActionBarSherlock. Select File->Import Module from IntelliJ IDEASelect library folder under ActionBarSherlock folder and import it as a new module. It will be imported as an Android library module.
  • Open module settings of ActionBarSherlock library module and export android-support-v4.jar dependency

  • Open module settings of your application which will make use of ActionBarSherlock and add a new Module Dependency

  • Select ActionBarSherlock from the list of modules

See step by step instructions with pictures

PS:Some tutorials on the internet directs you to add android-support-v4.jar to your application’s libs folder and add as a library dependency. Since ActionBarSherlock already includes it you do not have to do it, just export it from ActionBarSherlock. If you also add android-support-v4.jar as a library to your own module you may get UNXPECTED TOP LEVEL EXCEPTION.

Upvotes: 7

Mike Repass
Mike Repass

Reputation: 6962

You need to bump your target sdk. (Previous revisions of this Answer incorrectly said "you need to bump your min sdk, but that is incorrect as evidenced by the pasted ABS documentation below).

Even though it is intended to work on older versions of the Android platform, you must still compile ActionBarSherlock against 4.0 (or newer) release of the Android SDK.

Check here:

http://actionbarsherlock.com/usage.html

Requirements

Due to its use of the native action bar and its related classes on Ice Cream Sandwich, the library requires that both it and your project are compiled with Android 4.0 or newer. The project also requires that you are compiling with JDK 1.6 in both your editor and any build systems that you may be using.

Since the library is an extension of the official support library you must also have the android-support-v4.jar referenced by your project.

Also here:

http://actionbarsherlock.com/faq.html

The library itself must be built against Android 4.0 (API level 14). Your project should be built using the latest version of the SDK as possible as long as it is 4.0 or newer.

Targetting API level 11 or newer is required as it will cause Android to automatically add the native action bar when run on newer devices. Since you will be compiling against new APIs but your app will likely be run on devices with older versions of Android extra care must be taken to either avoid using or properly check and call any methods that were introduced after your minimum SDK version.

Upvotes: 1

Timmmm
Timmmm

Reputation: 96556

Go to File->Project Structure->Modules->You App->Dependencies. Click the + in the bottom left corner, and select Module Dependency. Choose ActionBarSherlock.

If it isn't there, make sure it is a library module - expand the ActionBarSherlock module and click Android, then check Is Library Project.

Upvotes: 0

toadzky
toadzky

Reputation: 3846

This issue, if I remember right, is cause by the Java compiler settings. Open the App Settings dialog, select Compiler -> Java Compiler and make sure that you have selected "Javac in-process (Java6+ only)" as the compiler you want to use.

FYI Google recommends using the lastest SDK to build against, so you should probably up your target SDK to 16.

Upvotes: 1

Related Questions