jfeinstein10 / SlidingMenu

An Android library that allows you to easily create applications with slide-in menus. You may use it in your Android apps provided that you cite this project and include the license in your app. Thanks!
Apache License 2.0
11.07k stars 5.04k forks source link

java.lang.NoClassDefFoundError: com.slidingmenu.lib.R$styleable #355

Closed marcindobry closed 11 years ago

marcindobry commented 11 years ago

Hi,

I have a problem in starting up the library in a clean project. I get

java.lang.NoClassDefFoundError: com.slidingmenu.lib.R$styleable

when doing

SlidingMenu slidingMenu = new SlidingMenu();

Configurations tested: JDK tested 1.6u43, 1.7(latest) Project target api = tried both Android 4.2.2 and Google API 17 SDK versions tested 21, 21.0.1, 21.1 Windows 8 Pro x64, Intel Core i7 3610QM, Nvidia GT660M, Samsung Pro 840 256GB SSD Integrated both with Actionbarsherlock and without it.

Below links to code snippets, full stacktrace and screenshots of current configurations

Code snippet: http://pastebin.com/2yzRC5AJ

Full Stacktrace: http://pastebin.com/D7RQwuQd

Current project configuration Project - http://scr.hu/0hoo/3dk8o SlidingMenu - http://scr.hu/0hoo/nlhzc

jfeinstein10 commented 11 years ago

This is definitely an issue with the way you set up the library. Please refer to the README file and then to Stack Overflow if you need help.

liushuaikobe commented 11 years ago

Have you solved this?I met the same problem now, and I don't know how to handle it.

liushuaikobe commented 11 years ago

@jfeinstein10 can you write the doc more detail? Now, I soved this by copying the source code to my src/ (the necessary res/ is also included), I don't know how to sove it permanently.

notreniev commented 11 years ago

Don't throw de towel yet... Just put int the manifest file the version of it.

I was having this issue using the slidemenu as a library on my project.

I did and it just work fine for me.

ricardopereira commented 11 years ago

The version of what? Can you specify, please. I'm facing the same problem right now.

notreniev commented 11 years ago

I've just created the META-INF folder in my src and puted the MANIFEST-MF on it. The MANIFEST.MF file must have the version attribute. It cannot be in blank, or the problem will persist.

Like this: Manifest-Version: 1.0

After this, you can export SlidingMenu.jar as a lib to be used in a android project without problem.

ricardopereira commented 11 years ago

Thanks. Btw, what's the right way to use SlidingMenu? Configuring SlidingMenu Library as dependency of my project or adding the jar file into my libs?

When I use it with dependency it works on AVD but if I try to export into a signed apk eclipse raise an exception on building.

When I use it with the jar file I can export it but I get java.lang.NoClassDefFoundError: com.jeremyfeinstein.slidingmenu.lib.R$layouts on running.

notreniev commented 11 years ago

I think the Library method is the right way.

You just have to pay attention about what files you export on eclipse.

What worked for me was to export the compiled source contained in the packages com.slidingmenu.lib in ths SRC folder, the META-INF folder and the GEN folder (selecting both BuildConfig.java and R.java classes).

The structure of your SlidingMenu.jar after you export all this files should looks like this:

BuildConfig.class CanvasTransformerBuilder.class CustomViewAbove.class CustomViewBehind.class MenuInterface.class R.class SlidingMenu.class META-INF

luvnish19 commented 9 years ago

App is crashing with same issue java.lang.NoClassDefFoundError: com.slidingmenu.lib.R$styleable. Only working in latest version (lollipop). Below all versions app is crashing. I had implemented sliding library in Android Studio via import module.