Android Question (Solved) NoClassDefFoundError When trying to use AHNavigationDrawer?

only1jake

Member
Licensed User
Longtime User
I have searched the forums and online in regards to this error.
The fixes I found were to move the android-support-v4.jar file to libraries folder or the additional libraries folder. Tried both and still get the below error. Also tried restarting computer and removing and re-adding the libraries required.

I have tried with android api 14 and api19.

I get the same error using this example:
http://www.b4x.com/android/forum/threads/actiondrawer-actionbar-and-navdrawer-made-perfect.32086/
and this one too:
http://www.b4x.com/android/forum/threads/ahnavigationdrawer-native-google-navigation-drawer.31461/

I believe my java is up to date.

I have spent a lot of time trying to fix this, please help :)
B4X:
** Activity (main) Create, isFirst = true **
java.lang.NoClassDefFoundError: de.amberhome.navdrawer.DrawerLayout$ViewDragCallback
    at de.amberhome.navdrawer.DrawerLayout.<init>(DrawerLayout.java:232)
    at de.amberhome.navdrawer.DrawerLayout.<init>(DrawerLayout.java:222)
    at de.amberhome.navdrawer.DrawerLayout.<init>(DrawerLayout.java:218)
    at de.amberhome.navdrawer.NavigationDrawer.Initialize2(NavigationDrawer.java:84)
    at de.amberhome.navdrawer.NavigationDrawer.Initialize(NavigationDrawer.java:63)
    at de.amberhome.NavDrawer2.main._activity_create(main.java:293)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:174)
    at de.amberhome.NavDrawer2.main.afterFirstLayout(main.java:98)
    at de.amberhome.NavDrawer2.main.access$100(main.java:16)
    at de.amberhome.NavDrawer2.main$WaitForLayout.run(main.java:76)
    at android.os.Handler.handleCallback(Handler.java:725)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:213)
    at android.app.ActivityThread.main(ActivityThread.java:5092)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:797)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:564)
    at dalvik.system.NativeStart.main(Native Method)
 
Last edited:

only1jake

Member
Licensed User
Longtime User
Thanks Erel. Android version on device is 4.2.2 and I think somewhere they said the minimum was 4.0. Phone is a Sony Xperia Z.
I just tried it in the emulator and I get the same error.
It's quite annoying because it seems this would be quite a nice thing to implement. Something must be wrong somewhere.
If anyone has any steps I can try to redo something?
 
Upvote 0

corwin42

Expert
Licensed User
Longtime User
I have searched the forums and online in regards to this error.
The fixes I found were to move the android-support-v4.jar file to libraries folder or the additional libraries folder. Tried both and still get the below error. Also tried restarting computer and removing and re-adding the libraries required.

I have tried with android api 14 and api19.

I get the same error using this example:
http://www.b4x.com/android/forum/threads/actiondrawer-actionbar-and-navdrawer-made-perfect.32086/
and this one too:
http://www.b4x.com/android/forum/threads/ahnavigationdrawer-native-google-navigation-drawer.31461/

I believe my java is up to date.

I have spent a lot of time trying to fix this, please help :)
B4X:
** Activity (main) Create, isFirst = true **
java.lang.NoClassDefFoundError: de.amberhome.navdrawer.DrawerLayout$ViewDragCallback
    at de.amberhome.navdrawer.DrawerLayout.<init>(DrawerLayout.java:232)
    at de.amberhome.navdrawer.DrawerLayout.<init>(DrawerLayout.java:222)
    at de.amberhome.navdrawer.DrawerLayout.<init>(DrawerLayout.java:218)
    at de.amberhome.navdrawer.NavigationDrawer.Initialize2(NavigationDrawer.java:84)
    at de.amberhome.navdrawer.NavigationDrawer.Initialize(NavigationDrawer.java:63)
    at de.amberhome.NavDrawer2.main._activity_create(main.java:293)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:174)
    at de.amberhome.NavDrawer2.main.afterFirstLayout(main.java:98)
    at de.amberhome.NavDrawer2.main.access$100(main.java:16)
    at de.amberhome.NavDrawer2.main$WaitForLayout.run(main.java:76)
    at android.os.Handler.handleCallback(Handler.java:725)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:213)
    at android.app.ActivityThread.main(ActivityThread.java:5092)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:797)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:564)
    at dalvik.system.NativeStart.main(Native Method)

Most likely you are using a too old android-support-v4 library. Open your SDK Manager. Scroll down the list to the Extras section and look what version of the Android Support Library you have. It should be 19.1.
Make sure that you don't have a old version in your build path. (Libraries folder in B4A Install directory and custum libraries path)
 
Upvote 0

only1jake

Member
Licensed User
Longtime User
Yeah I have the latest version. I tried replacing them again and now it works... Mustve done something wrong along the way. Thanks corwin.;)
 
Upvote 0

avacondios

Active Member
Licensed User
Longtime User
Hi,

I have exactly the same error ...under of Android 4.4.2 device and android-support-v4 library version 20. Can you propose any solution ?
 
Upvote 0
Top