Tess-two cannot find libpng.so

I followed the building instructions for tess-two on Github

I build tess-two using the NDK, successfully and imported the library I am trying to run a test application provided in the same repository, but whenever the application starts it gives the following exception: This error occurs after being called new TessBaseAPI();

.

dlopen("/data/app-lib/com.datumdroid.android.ocr.simple-2/liblept.so") failed: Cannot load library: soinfo_link_image(linker.cpp:1635): could not load library "libpng.so" needed by "liblept.so"; caused by load_library(linker.cpp:745): library "libpng.so" not found

      

Can anyone help with this?

+3


source to share


2 answers


I followed the suggestion of Dmitry Zaitsev and his descendants, also solved my problem.

Update your TessBaseAPI.java from the tess-two library project as shown below:



   static {
        System.loadLibrary("png");
        System.loadLibrary("lept");
        System.loadLibrary("tess");

        nativeClassInit();
     }

      

Create a tess-two project after updating this file. In my case, I created it using eclipse. Hope it should solve your problem as well.

+4


source


It seems that the call is System.loadLibrary("png")

missing in TessBaseAPI

, so the library cannot be found.

Try calling System.loadLibrary("png")

before calling new TessBaseAPI()

. This is usually done in an initialization block static

, for example:



public class MyClass {

    static {
        System.loadLibrary("png");
    }

    public void doStuff() {
        new TessBaseAPI();
    }
}

      

+2


source







All Articles