Java Question Loading .so library files error

Discussion in 'Libraries developers questions' started by walterf25, Jun 2, 2015.

  1. walterf25

    walterf25 Well-Known Member Licensed User

    Hello All, i'm trying to write a wrapper for a friend and it requires me to load two .so library riles.

    I'am using the following;

    However when i try the library i get the following error.

    Does anyone know why this is, or how can i fix this issue?

    I've also tried copying the .so files to the File.DirDefaultExternal directory, and then load the files like this:
    System.load(File.Combine(File.getDirDefaultExternal(), ""));
    When i do this i get this other error:

    I hope someone can help me figure out this problem, i have done other libraries in the past and I have been able to succesfully load the .so libraries, i'm not sure if this is an issue only related to L version, unfortunately i do not have a device with an older android version so that I can test on, If anyone has any advice or thoughts on this please let me know.

  2. Erel

    Erel Administrator Staff Member Licensed User

  3. walterf25

    walterf25 Well-Known Member Licensed User

  4. Erel

    Erel Administrator Staff Member Licensed User

    See the screenshot from the SQLCipher structure:


    In this case I'm using SLC to build the jar file and xml so the lib folder is inside the additional folder.
  5. DonManfred

    DonManfred Expert Licensed User

    The folder must be named libs!

    But you are referencing to another folder; not the libs folder... To place .so files you need to have
    a folder named "additional" with the following subfolders

    if you have an armeabi-v7a so file you need to copy it to the responsind folder.
    Some libraries have multiple so files. One for the armeabi folder, one for the armeabi-v7a folder, one for mips and one for x86

    You can use this folderstructure in every project. If you dont need to include .so files then you can leve the folders empty
  6. walterf25

    walterf25 Well-Known Member Licensed User

    Hi guys, thanks for your replies, here's a screen of the project's file structure, as you guys can see i have a folder named lib and a subfolder named armeabi, inside the armeabi folder are the two .so files.

    @DonManfred which one is it do I have to name the folder lib or libs?

    Do i need to add the folder additional?

    Thanks again for all your help guys.


    Attached Files:

  7. DonManfred

    DonManfred Expert Licensed User

    Do you compile with Eclipse or with the SLC?

    In case that you are using the SLC like me:
    I will show you my "This is my Template i use to build a new Wrapper"

    Download and extract please

    Every time i create a new wrapper i do copy this folder again to my workspace and change the name "_Basis" to the new wrappername.
    Lets say i name it "AndroidPos":
    A folder structure like this i have in my workspace


    The LIBS folder already contains two jars i often use. android-support-v4.jar AND android-support-v7-appcompat.jar
    If i dont need them for the new wrapper i delete the jars...
    If i need to include more or other jars i place them in this folder.

    The folder additional is not used by Eclipse as i dont compile with eclipse; i do with slc
    This folder contains a few other folders. They are all empty by default when i start a new wrapper.


    If i need to include a .so file i need to put the into the right folder.
    Note: some libraries comes with .so files for all of them; some only armeabi-a

    Ok. If i have a armeabi-v7/ i would place them into the armeabi-v7a folder.
    I do the same for all needed .so files.
    fredo and MarcoRome like this.
  8. walterf25

    walterf25 Well-Known Member Licensed User

    I use eclipse to compile the library, i've tried using slc before, but couldn't figure out how to use it as it was giving me some errors. Let me give it a try again.

  9. walterf25

    walterf25 Well-Known Member Licensed User

    So I just tried using SLC tool, but it gives me all kinds of errors, I think the reason is because this library was done by a Chinese person, and the source file contains many unknown characters, for example this line, i have no idea what the hell that is.
    if(str.equals("ä¸æ–‡ï¼ˆç¹?/简 ä½“)")){
    So the SLC tool complains about this line here is the error i get while trying to compile.

    When I compile with eclipse, it compiles just fine, but then again i'm having a problem with loading the .so files.

    Any other ideas/thoughts?

  10. DonManfred

    DonManfred Expert Licensed User

    what happen inside this if-block? Maybe you just need to check for englishnamed values
  11. walterf25

    walterf25 Well-Known Member Licensed User

    Don, this is the entire function, i believe is for unicode characters
    public void write_Unicode(String msg,String str)
    try {
    if(msg == null)
                        msg = 
    if(str.equals("ä¸æ–‡ï¼ˆç¹?/简 ä½“)")){
    for(int i=0;i<msg.length();i++){
    String s = msg.substring(i, i+1);
                                byte[] bytes = s.getBytes();
                                byte[] writebytes = {
                    }else if(str.equals("English")){
            } catch (IOException e1) {
            } catch (InterruptedException e) {
                // TODO Auto-generated catch block
    I'm not sure what what's going on there!

  12. MarcoRome

    MarcoRome Expert Licensed User

    And work without problem :)
    DonManfred likes this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice