rmtheis / tess-two

Fork of Tesseract Tools for Android
Apache License 2.0
3.76k stars 1.38k forks source link

base.apk!/lib/arm64-v8a, /vendor/lib64, /system/lib64]]] couldn't find "libjpgt.so" #225

Closed amarpulli1994 closed 6 years ago

amarpulli1994 commented 6 years ago

Summary: I am using 'com.rmtheis:tess-two:8.0.0' and compiled for below architectures

ndk { abiFilters "armeabi-v7a", "arm64-v8a" } it works for "armeabi-v7a" only.

Steps to reproduce the issue:

  1. create a new android app using tess-two.
  2. add following architecture. ndk { abiFilters "armeabi-v7a", "arm64-v8a" }
  3. Then from android app call TessBaseAPI baseApi = new TessBaseAPI();

Expected result:

it should execute the TessBaseAPI without any issues.

Actual result:

FATAL EXCEPTION: main
                                                                    Process: com.scanner.cheque, PID: 17592
                                                                    java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.scanner.cheque-1/base.apk"],nativeLibraryDirectories=[/data/app/com.scanner.cheque-1/lib/arm64, /data/app/com.scanner.cheque-1/base.apk!/lib/arm64-v8a, /vendor/lib64, /system/lib64]]] couldn't find "libjpgt.so"
                                                                        at java.lang.Runtime.loadLibrary(Runtime.java:367)
                                                                        at java.lang.System.loadLibrary(System.java:1076)
                                                                        at com.googlecode.tesseract.android.TessBaseAPI.<clinit>(TessBaseAPI.java:44)
                                                                        at com.scanner.cheque.MainActivity$1.onClick(MainActivity.java:220)
                                                                        at android.view.View.performClick(View.java:5272)
                                                                        at android.view.View$PerformClick.run(View.java:21528)
                                                                        at android.os.Handler.handleCallback(Handler.java:815)
                                                                        at android.os.Handler.dispatchMessage(Handler.java:104)
                                                                        at android.os.Looper.loop(Looper.java:207)
                                                                        at android.app.ActivityThread.main(ActivityThread.java:5790)
                                                                        at java.lang.reflect.Method.invoke(Native Method)
                                                                        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1015)
                                                                        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:876)

Tess-two version:

com.rmtheis:tess-two:8.0.0

Android version:

android 7.1.1

Phone/device model:

one plus 3t, vivo 5.

Phone/device architecture (armeabi, armeabi-v7a, x86, mips, arm64-v8a, x86_64, mips64):

arm64-v8a

Link to training data used:

not required.

Link to image used as input:

not required.

amarpulli1994 commented 6 years ago

Hi,

Do we need to make changes as mentioned in commit https://github.com/rmtheis/tess-two/pull/124/ to libjpeg ?

libpng has added support for "arm64-v8a" and not libjpeg, because we searched "ARM_NEON" in repository and only found in (https://github.com/rmtheis/tess-two/search?utf8=%E2%9C%93&q=ARM_NEON&type=) in below files.

tess-two/jni/libpng/pngpriv.h tess-two/jni/libpng/configure.ac tess-two/jni/libpng/scripts/pnglibconf.dfa tess-two/jni/libpng/CHANGES

Thanks.

amarpulli1994 commented 6 years ago

Hi,

Sorry for closing without providing details.

We resolved the issue by using below version of tess-two. compile 'com.rmtheis:tess-two:7.0.0'

We also added below code before calling the api as below.

 System.loadLibrary("jpgt");

                        TessBaseAPI baseApi = new TessBaseAPI();
                        baseApi.setDebug(true);
                        baseApi.init(DATA_PATH, lang1);

We will not close this issue since it is still persists in 8.0.0

Thanks.

rmtheis commented 6 years ago

Thanks for contributing this.

I wasn't able to reproduce this issue when running the unit tests on 64-bit emulator. Do the unit tests pass for you?

rmtheis commented 6 years ago

I tried reproducing this on a 64-bit device and a 64-bit emulator. I wasn't able to reproduce the issue. Please reopen if you're able to provide more info.

juechenshiai commented 6 years ago

I have the same problem with 8.0.0

rmtheis commented 6 years ago

Possibly related to #150.

sarendshorst commented 6 years ago

@rmtheis With 7.0.0 I get the following libs: screen shot 2017-11-29 at 13 48 03

With 8.0.0: screen shot 2017-11-29 at 13 52 15

What should I do to get the missing libs on 8.0.0?

rmtheis commented 6 years ago

@Nfear That's working as intended. Use 7.0.0 or follow the instructions in BUILDING.md to do the build step manually

JcMinarro commented 6 years ago

I am getting the same problem with version 8.0.0, How could I use version 8.0.0 on 64-bit devices?