3

I'm trying to use the SherlockMapActivity to use the Sherlock action bar on a maps activity. But when the activity which extends from SherlockMapActivity is started a NoClassDefFoundError exception is thrown telling me the class cannot be found.

When I change the implementation and use the normal MapActivity as a base class then the activity starts without any problems.

I included the actionbarsherlock-plugin-maps-4.0.0.jar int the lib folder and included it in the class path. Support library 4 is also included. The Sherlock action bar works an all other activities which don't extend from SherlockMapActivity.

I don't now whether this might be important,the map activity using the Sherlock action bar is part of a library project.

Any ideas on that?

UPDATE

08-29 23:08:38.326: E/AndroidRuntime(8862): FATAL EXCEPTION: main
08-29 23:08:38.326: E/AndroidRuntime(8862): java.lang.NoClassDefFoundError: com.appandmore.android.storefinder.core.ui.activity.RadiusStoreActivity
08-29 23:08:38.326: E/AndroidRuntime(8862):     at com.appandmore.android.storefinder.core.ui.activity.HomeActivity.onClick(HomeActivity.java:70)
08-29 23:08:38.326: E/AndroidRuntime(8862):     at android.view.View.performClick(View.java:2506)
08-29 23:08:38.326: E/AndroidRuntime(8862):     at android.view.View$PerformClick.run(View.java:9112)
08-29 23:08:38.326: E/AndroidRuntime(8862):     at android.os.Handler.handleCallback(Handler.java:587)
08-29 23:08:38.326: E/AndroidRuntime(8862):     at android.os.Handler.dispatchMessage(Handler.java:92)
08-29 23:08:38.326: E/AndroidRuntime(8862):     at android.os.Looper.loop(Looper.java:130)
08-29 23:08:38.326: E/AndroidRuntime(8862):     at android.app.ActivityThread.main(ActivityThread.java:3835)
08-29 23:08:38.326: E/AndroidRuntime(8862):     at java.lang.reflect.Method.invokeNative(Native Method)
08-29 23:08:38.326: E/AndroidRuntime(8862):     at java.lang.reflect.Method.invoke(Method.java:507)
08-29 23:08:38.326: E/AndroidRuntime(8862):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:864)
08-29 23:08:38.326: E/AndroidRuntime(8862):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:622)
08-29 23:08:38.326: E/AndroidRuntime(8862):     at dalvik.system.NativeStart.main(Native Method)

UPDATE 2

I've temporarily replaced the map activity with a plain one, containing no custom code, just extending SherlockMapActivty. It crashed to the same reason.

Flo
  • 27,355
  • 15
  • 87
  • 125
  • See this answer http://stackoverflow.com/questions/10037125/actionbarsherlock-maps-loaders-java-lang-noclassdeffounderror?lq=1 and this http://stackoverflow.com/questions/11545912/android-classnotfoundexception-when-running-actionbarsherlock-plugin-maps?lq=1 maybe it'll help. – androidEnthusiast Aug 29 '12 at 21:33
  • The logs will tell you why the class was evicted and what's missing. Please provide them. – Jake Wharton Aug 29 '12 at 21:52
  • Try to remove support-library from Sherlock and then add it again (but this time - newest one). – Dmitry Zaytsev Aug 30 '12 at 07:20

1 Answers1

3

You have to keep your .jar file inside libs not lib folder after ADT-17. Also, its not mandatory to Build Path it will be managed on its own.

Lalit Poptani
  • 67,150
  • 23
  • 161
  • 242
  • Thanks for the advise. I changed it, but it doesn't solve the problem. Still getting the same error. – Flo Aug 30 '12 at 10:12
  • Try to restart eclipse and check that you have removed the Build Path added previously. – Lalit Poptani Aug 30 '12 at 10:13
  • Hey, I am having the same problem. I did the same but I still have the problem. Just to make it clear: I removed jar file from Java Build Path -> Libraries and then added it to "libs" folder. I have also restarted eclipse but no help. Is there anything else I can try? – Sharjeel Aug 31 '12 at 00:07
  • 2
    Ok. Fixed it. I wasn't including in my manifest file. Thanks for the rest of the answers :) – Sharjeel Aug 31 '12 at 00:44
  • 1
    +1 how many times do i forget that stupid `uses-lib` tag - the log errors always mislead me - damn my memory! – Dori Nov 09 '12 at 16:56
  • If the uses tag is the correct answer please post it and mark it as correct for others to find :) – Janusz Nov 20 '12 at 08:52