3

I have an app that has both java and NDK (C code). This app is running fine on the Motorola Xoom, but fails on the Archos 101 tablet.

Here is the offending code:

    static {
    try
    {
        System.loadLibrary("cube");
    }
    catch (Exception ex)
    {
        Log.d("scroll", ex.getMessage());
    }
}

Here is the logcat dump on the error:

DEBUG/dalvikvm(10198): Trying to load lib /data/data/com.gorglucks.cubendk/lib/libcube.so 0x45497b18
INFO/dalvikvm(10198): Unable to dlopen(/data/data/com.gorglucks.cubendk/lib/libcube.so): Cannot load library: link_image[1995]: failed to link libcube.so
WARN/dalvikvm(10198): Exception Ljava/lang/UnsatisfiedLinkError; thrown during Lcom/gorglucks/cubendk/Main;.<clinit>
WARN/dalvikvm(10198): Class init failed in newInstance call (Lcom/gorglucks/cubendk/Main;)
DEBUG/AndroidRuntime(10198): Shutting down VM
WARN/dalvikvm(10198): threadid=1: thread exiting with uncaught exception (group=0x4001d8a8)
ERROR/AndroidRuntime(10198): FATAL EXCEPTION: main
ERROR/AndroidRuntime(10198): java.lang.ExceptionInInitializerError
ERROR/AndroidRuntime(10198):     at java.lang.Class.newInstanceImpl(Native Method)
ERROR/AndroidRuntime(10198):     at java.lang.Class.newInstance(Class.java:1429)
ERROR/AndroidRuntime(10198):     at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
ERROR/AndroidRuntime(10198):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
ERROR/AndroidRuntime(10198):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
ERROR/AndroidRuntime(10198):     at android.app.ActivityThread.access$2300(ActivityThread.java:125)
ERROR/AndroidRuntime(10198):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
ERROR/AndroidRuntime(10198):     at android.os.Handler.dispatchMessage(Handler.java:99)
ERROR/AndroidRuntime(10198):     at android.os.Looper.loop(Looper.java:123)
ERROR/AndroidRuntime(10198):     at android.app.ActivityThread.main(ActivityThread.java:4627)
ERROR/AndroidRuntime(10198):     at java.lang.reflect.Method.invokeNative(Native Method)
ERROR/AndroidRuntime(10198):     at java.lang.reflect.Method.invoke(Method.java:521)
ERROR/AndroidRuntime(10198):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
ERROR/AndroidRuntime(10198):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
ERROR/AndroidRuntime(10198):     at dalvik.system.NativeStart.main(Native Method)
ERROR/AndroidRuntime(10198): Caused by: java.lang.UnsatisfiedLinkError: Library cube not found
ERROR/AndroidRuntime(10198):     at java.lang.Runtime.loadLibrary(Runtime.java:461)
ERROR/AndroidRuntime(10198):     at java.lang.System.loadLibrary(System.java:557)
ERROR/AndroidRuntime(10198):     at com.gorglucks.cubendk.Main.<clinit>(Main.java:24)
ERROR/AndroidRuntime(10198):     ... 15 more

My C library libcube.so is in libs/armeabi/libcube.so and shows up in the eclipse Project explorer. I have verified this, by looking in CubeNDK.apk .

Also I tried to load the lib using:

System.load("/data/data/com.gorglucks.cubendk/lib/armeabi/libcube.so");

This failed as well.

Again, this works fine on the Motorola Xoom. In general, working with this Archos 101 has been very frustrating. The usb driver is not working for me on 64bit PCs, but will work on older 32bit PCs.

Thanks in advance Jerry

Community
  • 1
  • 1
RaiderJ
  • 193
  • 1
  • 7
  • Are you sure libcube isn't trying to load another library which isn't present in the directory? – Cheesebaron Dec 09 '11 at 15:26
  • I am pretty sure every thing is present, here are my includes: #include #include #include #include #include #include #include #include #include #include #include – RaiderJ Dec 09 '11 at 20:24
  • LOCAL_MODULE := cube LOCAL_CFLAGS := -DANDROID_NDK LOCAL_SRC_FILES := cube.c DDSOpengl.c DDSReader.c screenGrab.c PVROpengl.c PVRReader.c LOCAL_LDLIBS := -lGLESv1_CM -ldl -llog LOCAL_LDLIBS += -landroid – RaiderJ Dec 09 '11 at 20:37

1 Answers1

0

Through a process of elimination, and digging into the documentation android-ndk-r7/docs/STABLE-APIS.html, the asset manager is not available in API level 8 (Froyo).

This solves my link problem, but creates another issue:

How do you access files in the assets directory from the ndk without using the asset manager?

RaiderJ
  • 193
  • 1
  • 7
  • If you have another question then post it separately. Also, it would be helpful for `android-ndk-r7/docs/STABLE-APIS.html` to be a working hyperlink. Good luck with your question. – Pubby Dec 13 '11 at 00:12