Patrick Jackson
Patrick Jackson

Reputation: 19416

Actionbarsherlock noClassDefFoundError com.actionbarsherlock.R$styleable

I am migrating my code to use Actionbarsherlock. I have made all the code adaption that I need to and my project compiles fine with no errors, however I get the following exception:

java.lang.NoClassDefFoundError: com.actionbarsherlock.R$Styleable at com.actionbarsherlock.internal.ActionbarSherlockCompat.generateLayout(ActionbarSherlockCompat.java 1002)

I am using version 4.1 of actionbar sherlock. I get this exception when the first activity starts every time. I have cleaned and rebuild the project, checked my buildpaths, and can not find what is missing. Anyhelp would be great!!!

Upvotes: 3

Views: 2782

Answers (5)

keybee
keybee

Reputation: 1496

This happened to me after signing the application. The signed apk was returning the above error, while before signing everything worked well. Closing that damn eclipse and starting it again (built in restart option did not work) did the trick for me.

Upvotes: 0

Freddy
Freddy

Reputation: 784

This issue may caused by ADT version,I solved this issue by using adt-bundle-windows-x86.

Upvotes: 0

Tobias
Tobias

Reputation: 7415

Had the same issue. updating to the latest version of actionbarsherlock and doing a clean all helped me.

Upvotes: 2

TouchBoarder
TouchBoarder

Reputation: 6492

I got this Error to when using the SDK Tools Preview 21 and the ADT preview.

Occurred when inflating menu items with actionbarsherlock using. getSupportMenuInflater().inflate(R.menu.search, menu);

Reverting to SDK Tools 20 fixed it.

logcat error:

11-03 09:29:44.738: E/AndroidRuntime(14878): java.lang.NoClassDefFoundError: com.actionbarsherlock.R$styleable
11-03 09:29:44.738: E/AndroidRuntime(14878):    at com.actionbarsherlock.view.MenuInflater$MenuState.readItem(MenuInflater.java:343)
11-03 09:29:44.738: E/AndroidRuntime(14878):    at com.actionbarsherlock.view.MenuInflater.parseMenu(MenuInflater.java:162)
11-03 09:29:44.738: E/AndroidRuntime(14878):    at com.actionbarsherlock.view.MenuInflater.inflate(MenuInflater.java:112)

Upvotes: 11

Erol
Erol

Reputation: 6526

If you’re using the Eclipse Development Environment with the ADT plugin version 0.9.7 or greater you can include ActionBarSherlock as a library project. Create a new Android project in Eclipse using the library/ folder as the existing source. Then, in your project properties, add the created project under the ‘Libraries’ section of the ‘Android’ category.

The rest of the user manual is here.

Upvotes: 3

Related Questions