1. Download our Official Android App: Forums for Android!

Apps How we use SO library files with NDK?

Discussion in 'Android Development' started by xhuutrix, May 9, 2011.

  1. xhuutrix

    xhuutrix Lurker
    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    1
    Joined:
    May 9, 2011

    May 9, 2011
    1
    0
    5
    Hi All,
    I am beginer to learn NDK to support C code to Android,
    Can anybody help to explain how to fix the problem below:

    1. I am implemented 2 shared library and use these to JNI code to let android can call, i am using NDK to build, it succeed.

    2. I run the android app, it failed to load library, the problem seems it can not find other library that linked at build time. I have copied these library to same folder with main lib (JNI implement lib /data/data/com.learn/lib/*.so) but it still fail, and i am trying to copy to /system/lib but it can not since i see all others .so are placed at this folder.

    So my question is that:
    1. where to put so files to let app can load by using System.load or System.loadLibrary

    2. If i use static lib then it is OK, but based on two-libs example i don't see how we load from an built static lib as .a so can you tell me how to link to file .a (static lib) from config make file?

    3. Can android work with other so file that built from linux OS with gcc or other compiler? or it should just work so, or .a file that built from NDK?

    Thank in advance!
     

    Advertisement

  2. aashishvijayvi

    Rank:
    None
    Points:
    5
    Posts:
    2
    Joined:
    May 31, 2011

    May 31, 2011
    2
    0
    5
    actually it will work with arm libraries.

    these libraries can be generated by the arm-gp2x-linux-gcc command.


    i m placing the so files in the jni same as jni.c file folder.
    and it is loading from there. but i m having the problem of unsatisfied linker error. when i restart eclipse and run again .
    can you help me in this problem..


    i m attaching my sample project
    thanks
     

    Attached Files:

Share This Page

Loading...