RaiderJ
RaiderJ

Reputation: 203

Archos 101 Tablet System.load() fails when loading ndk lib

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

Upvotes: 3

Views: 721

Answers (1)

RaiderJ
RaiderJ

Reputation: 203

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?

Upvotes: 0

Related Questions