0

I made a native extension for Flex which works fine. When calling Java functions from Flex I get the desired result. But if I want to load a shared library in Java the application crashes at startup.

The code for loading the library:

public static void loadLibrary(String sLibName) {
            try {
                System.loadLibrary(sLibName);
            } catch(UnsatisfiedLinkError e) {
                (...)


@Override
    public void initialize() {
        // called when the native extension is ready to be used
        Debug.info("Extension initialized");
        loadLibrary("Native");

Logcat gives me the following log report:

01-18 15:14:25.824: I/ColijnIT-AR(15349): Extension initialized
01-18 15:14:25.824: D/dalvikvm(15349): Trying to load lib /data/data/air.NativeJavaTest.debug/lib/libNative.so 0x41312378
01-18 15:14:25.834: D/dalvikvm(15349): Added shared lib /data/data/air.NativeJavaTest.debug/lib/libNative.so 0x41312378
01-18 15:14:25.834: W/System.err(15349): java.lang.NoClassDefFoundError: java/util/UUID
01-18 15:14:25.834: W/System.err(15349):    at java.lang.Runtime.nativeLoad(Native Method)
01-18 15:14:25.834: W/System.err(15349):    at java.lang.Runtime.loadLibrary(Runtime.java:368)
01-18 15:14:25.834: W/System.err(15349):    at java.lang.System.loadLibrary(System.java:535)

If I remove the loadLibrary("Native") call in the method initialize I get no errors and everything works fine. But when the library is succesfully done loading and is added (according to logcat) it gives me the NoClassDefFoundError

Wessel van der Linden
  • 2,592
  • 2
  • 21
  • 42

1 Answers1

0

As per the stack trace I can say that, it unable to find java.util.UUID class. In order solve this issue you need to add jar file containing java.util.UUID class to class path of your project. The jar file containing java.util.UUID is rt.jar. So simply add rt.jar to your class path, your problem will be solved. Hope it helps.

Raju Rudru
  • 1,102
  • 12
  • 19