I have an Android project using Gradle and I want to add the library Mobile OCR Engine.

I add MobileOcrEngine.jar under libs folder and libMobileOcrEngine.so under libs/armeabi, following steps in documentation. I also add the gradle compile statement:

compile files('libs/MobileOcrEngine.jar')

Then, in my Application::onCreate method I add the following code (copied from example):

final DataSource assetDataSource = new AssetDataSource(getAssets());

final List<DataSource> dataSources = new ArrayList<>();
dataSources.add(assetDataSource);

Engine.loadNativeLibrary(); // ERROR HERE!
try {
  Engine.createInstance(dataSources,
                   new FileLicense(assetDataSource, LICENSE, APPLICATION_ID),
                   new Engine.DataFilesExtensions(PATTERNS_FILE_EXTENSION,
                                          DICTIONARIES_FILE_EXTENSION,
                                          KEYWORDS_FILE_EXTENSION));

  RecognitionContext.createInstance(this);
} catch (final IOException e) {
  Log.e("VrLApplication", "setupAbbyyEngine " + e.getMessage());
} catch (final License.BadLicenseException e) {
  Log.e("VrLApplication", "setupAbbyyEngine " + e.getMessage());
}

But when I run it, I get the following error:

02-08 12:41:36.931 1882-1882/p.vrl E/AndroidRuntime: FATAL EXCEPTION: main
02-08 12:41:36.931 1882-1882/p.vrl E/AndroidRuntime: Process: prototype.vrleasing, PID: 1882
02-08 12:41:36.931 1882-1882/p.vrl E/AndroidRuntime: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/p.vrl-2/base.apk"],nativeLibraryDirectories=[/data/app/p.vrl-2/lib/arm, /vendor/lib, /system/lib]]] couldn't find "libMobileOcrEngine.so"
02-08 12:41:36.931 1882-1882/p.vrl E/AndroidRuntime:     at java.lang.Runtime.loadLibrary(Runtime.java:366)
02-08 12:41:36.931 1882-1882/p.vrl E/AndroidRuntime:     at java.lang.System.loadLibrary(System.java:988)
02-08 12:41:36.931 1882-1882/p.vrl E/AndroidRuntime:     at com.abbyy.mobile.ocr4.Engine.loadNativeLibrary(Engine.java:270)
02-08 12:41:36.931 1882-1882/p.vrl E/AndroidRuntime:     at p.vrl.VrLApplication.setupAbbyyEngine(VrLeasingApplication.java:61)
02-08 12:41:36.931 1882-1882/p.vrl E/AndroidRuntime:     at p.vrl.VrLApplication.onCreate(VrLeasingApplication.java:40)
02-08 12:41:36.931 1882-1882/p.vrl E/AndroidRuntime:     at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1035)
02-08 12:41:36.931 1882-1882/p.vrl E/AndroidRuntime:     at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4638)
02-08 12:41:36.931 1882-1882/p.vrl E/AndroidRuntime:     at android.app.ActivityThread.access$1500(ActivityThread.java:155)
02-08 12:41:36.931 1882-1882/p.vrl E/AndroidRuntime:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1378)
02-08 12:41:36.931 1882-1882/p.vrl E/AndroidRuntime:     at android.os.Handler.dispatchMessage(Handler.java:102)
02-08 12:41:36.931 1882-1882/p.vrl E/AndroidRuntime:     at android.os.Looper.loop(Looper.java:135)
02-08 12:41:36.931 1882-1882/p.vrl E/AndroidRuntime:     at android.app.ActivityThread.main(ActivityThread.java:5343)
02-08 12:41:36.931 1882-1882/p.vrl E/AndroidRuntime:     at java.lang.reflect.Method.invoke(Native Method)
02-08 12:41:36.931 1882-1882/p.vrl E/AndroidRuntime:     at java.lang.reflect.Method.invoke(Method.java:372)
02-08 12:41:36.931 1882-1882/p.vrl E/AndroidRuntime:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905)
02-08 12:41:36.931 1882-1882/p.vrl E/AndroidRuntime:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700)

Any guess what am I doing wrong?

asked 09 Feb '16, 13:11

David%20Aguiar's gravatar image

David Aguiar
112

We sent you the instructions as a response to your e-mail to ABBYY support regarding the same question.

(10 Feb '16, 19:38) IvanPopov ♦♦

You have to put the .so file in 'jniLibs' directory (e.g.the Sample\app\src\main\jniLibs\armeabi-v7a\*.so)

link

answered 01 Mar '16, 20:10

Lonzak's gravatar image

Lonzak
112

edited 01 Mar '16, 20:10

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×52
×13
×1

Asked: 09 Feb '16, 13:11

Seen: 1,220 times

Last updated: 01 Mar '16, 20:10

© 2016 ABBYY. All rights Reserved. www.ABBYY.com | Privacy Policy | Legal