Java Question NoClassDefFoundError for library

jdkellow

Member
Licensed User
Longtime User
Having followed the tutorials carefully, I am stuck with the NoClassDefFound error when creating and using a library - have tried all the suggestions in the forum but no success. I have reduced the library to a very simple example, but still get this error.

** Activity (main) Create, isFirst = true **
main_activity_create (java line: 206)
java.lang.NoClassDefFoundError: jd.jdlib.jdlib
at jd.jdtest.main._activity_create(main.java:206)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:491)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:170)
at jd.jdtest.main.afterFirstLayout(main.java:84)
at jd.jdtest.main.access$100(main.java:16)
at jd.jdtest.main$WaitForLayout.run(main.java:72)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:132)
at android.app.ActivityThread.main(ActivityThread.java:4126)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:491)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:844)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
at dalvik.system.NativeStart.main(Native Method)
** Activity (main) Resume **


Lib source is:

package jd.jdlib;

import anywheresoftware.b4a.BA.ShortName;
@ShortName("jdlib")
public class jdlib {
public static boolean value() {
return true;
}
}


Test app is:

'Activity module
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub

Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
End Sub

Sub Activity_Create(FirstTime As Boolean)
Dim jd As jdlib
Msgbox("Test Lib ",jd.value)
End Sub

Sub Activity_Resume
End Sub

Sub Activity_Pause (UserClosed As Boolean)
End Sub


Any clue would be helpful - even a simple lib that works to examine.

Cheers
 

jdkellow

Member
Licensed User
Longtime User
Thanks for the quick response - works perfectly!

Now to install v2.0 and get going
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…