UnsatisfiedLinkError - com.datumdroid.android.ocr.simple couldn't find "libjpgt.so" - android

I'm new to Android Studios and I am doing this OCR http://swlock.blogspot.com/2016/07/ocr-tesseract-2.html where the image convert to text but everytime I take an image app the will close and got this error. Anyone can guide me to fix this error? Thanks
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.datumdroid.android.ocr.simple, PID: 2425
java.lang.UnsatisfiedLinkError: com.android.tools.fd.runtime.IncrementalClassLoader$DelegateClassLoader[DexPathList[[dex file "/data/data/com.datumdroid.android.ocr.simple/files/instant-run/dex/slice-slice_9-classes.dex", dex file "/data/data/com.datumdroid.android.ocr.simple/files/instant-run/dex/slice-slice_8-classes.dex", dex file "/data/data/com.datumdroid.android.ocr.simple/files/instant-run/dex/slice-slice_7-classes.dex", dex file "/data/data/com.datumdroid.android.ocr.simple/files/instant-run/dex/slice-slice_6-classes.dex", dex file "/data/data/com.datumdroid.android.ocr.simple/files/instant-run/dex/slice-slice_5-classes.dex", dex file "/data/data/com.datumdroid.android.ocr.simple/files/instant-run/dex/slice-slice_4-classes.dex", dex file "/data/data/com.datumdroid.android.ocr.simple/files/instant-run/dex/slice-slice_3-classes.dex", dex file "/data/data/com.datumdroid.android.ocr.simple/files/instant-run/dex/slice-slice_2-classes.dex", dex file "/data/data/com.datumdroid.android.ocr.simple/files/instant-run/dex/slice-slice_1-classes.dex", dex file "/data/data/com.datumdroid.android.ocr.simple/files/instant-run/dex/slice-slice_0-classes.dex"],nativeLibraryDirectories=[/data/app/com.datumdroid.android.ocr.simple-2/lib/x86, /system/lib, /vendor/lib]]] couldn't find "libjpgt.so"
at java.lang.Runtime.loadLibrary0(Runtime.java:972)
at java.lang.System.loadLibrary(System.java:1530)
at com.googlecode.tesseract.android.TessBaseAPI.<clinit>(TessBaseAPI.java:44)
at com.datumdroid.android.ocr.simple.SimpleAndroidOCRActivity.onPhotoTaken(SimpleAndroidOCRActivity.java:214)
at com.datumdroid.android.ocr.simple.SimpleAndroidOCRActivity.onActivityResult(SimpleAndroidOCRActivity.java:138)
at android.app.Activity.dispatchActivityResult(Activity.java:6915)
at android.app.ActivityThread.deliverResults(ActivityThread.java:4049)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:4096)
at android.app.ActivityThread.-wrap20(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1516)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
Application terminated.

That means that the *.so files are not in your *.apk file. Follow the steps in this stackoverflow question/answer.
You can always go to Build > Analyze APK... to see if the *.so files are getting added. Obviously, if they are not in the APK, then there is no reason to attempt to run the app that needs the *.so files.

Related

Failed to load .so in android studio

I wanted to load a .so file: System.loadLibrary("example");
but i faced with this error!!
this is the error:
FATAL EXCEPTION: main
Process: com.name.ex, PID: 30737
java.lang.UnsatisfiedLinkError: dlopen failed: file offset for the library "/data/app/com.name.ex-1/lib/arm/example.so" >= file size: 0 >= 0
at java.lang.Runtime.loadLibrary(Runtime.java:372)
at java.lang.System.loadLibrary(System.java:1076)
at com.name.ex.example<clinit>(example.java:582)
at java.lang.Class.newInstance(Native Method)
at android.app.Instrumentation.newApplication(Instrumentation.java:1020)
at android.app.Instrumentation.newApplication(Instrumentation.java:1005)
at android.app.LoadedApk.makeApplication(LoadedApk.java:670)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6395)
at android.app.ActivityThread.access$1800(ActivityThread.java:229)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1887)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:7325)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
you might have placed the native assembly for ARM into the wrong directory ...or the file-size is indeed 0. it's ordinary called armeabi-v7a instead of arm, for example (the jniLibs path might need to be adjusted, depending how your project looks alike):
app/src/main/jniLibs/armeabi-v7a
in the module-level build.gradle one can define the location:
android {
...
sourceSets {
main {
jniLibs.srcDir "src/main/jniLibs"
}
}
}

UnsatisfiedLinkError: No implementation found for void com.mopo.audiofingerprinter.tageditor.ACRCloudExtrTool.native_init()

I cloned this project and and copied the .so files to my project's jniLibs folder.
After that, it looked like this:
However, when I tried using the library it throws:
09-18 10:22:53.861 18439-19193/com.mopo.audiofingerprinter W/linker: libACRCloudExtrTool.so: unused DT entry: type 0x6ffffffe arg 0x4718
09-18 10:22:53.861 18439-19193/com.mopo.audiofingerprinter W/linker: libACRCloudExtrTool.so: unused DT entry: type 0x6fffffff arg 0x2
09-18 10:22:53.871 18439-19193/com.mopo.audiofingerprinter E/art: No implementation found for void com.mopo.audiofingerprinter.tageditor.ACRCloudExtrTool.native_init() (tried Java_com_mopo_audiofingerprinter_tageditor_ACRCloudExtrTool_native_1init and Java_com_mopo_audiofingerprinter_tageditor_ACRCloudExtrTool_native_1init__)
09-18 10:22:53.881 18439-19193/com.mopo.audiofingerprinter E/UncaughtException: java.lang.UnsatisfiedLinkError: No implementation found for void com.mopo.audiofingerprinter.tageditor.ACRCloudExtrTool.native_init() (tried Java_com_mopo_audiofingerprinter_tageditor_ACRCloudExtrTool_native_1init and Java_com_mopo_audiofingerprinter_tageditor_ACRCloudExtrTool_native_1init__)
at com.mopo.audiofingerprinter.tageditor.ACRCloudExtrTool.native_init(Native Method)
at com.mopo.audiofingerprinter.tageditor.ACRCloudExtrTool.<clinit>(ACRCloudExtrTool.java:57)
at com.mopo.audiofingerprinter.tageditor.ACRCloudExtrTool.createFingerprintByFile(ACRCloudExtrTool.java:0)
at com.mopo.audiofingerprinter.tageditor.ACRCloudRecognizer.recognizeByFile(ACRCloudRecognizer.java:129)
at com.mopo.audiofingerprinter.tageditor.TestActivity$RecThread.run(TestActivity.java:84)
09-18 10:22:54.132 18439-19193/com.mopo.audiofingerprinter E/AndroidRuntime: FATAL EXCEPTION: Thread-51298
Process: com.mopo.audiofingerprinter, PID: 18439
java.lang.UnsatisfiedLinkError: No implementation found for void com.mopo.audiofingerprinter.tageditor.ACRCloudExtrTool.native_init() (tried Java_com_mopo_audiofingerprinter_tageditor_ACRCloudExtrTool_native_1init and Java_com_mopo_audiofingerprinter_tageditor_ACRCloudExtrTool_native_1init__)
at com.mopo.audiofingerprinter.tageditor.ACRCloudExtrTool.native_init(Native Method)
at com.mopo.audiofingerprinter.tageditor.ACRCloudExtrTool.<clinit>(ACRCloudExtrTool.java:57)
at com.mopo.audiofingerprinter.tageditor.ACRCloudExtrTool.createFingerprintByFile(ACRCloudExtrTool.java:0)
at com.mopo.audiofingerprinter.tageditor.ACRCloudRecognizer.recognizeByFile(ACRCloudRecognizer.java:129)
at com.mopo.audiofingerprinter.tageditor.TestActivity$RecThread.run(TestActivity.java:84)
The weird thing, is that the compiled project I cloned is working without errors. I have even attempted copying the classes from the demo and still it didn't work.
EDIT
After implementing Divy Soni's answer, the jniLibs folder disappeared entirely. And when I built the app it crashed with:
`09-18 11:21:46.848 26158-26798/com.mopo.audiofingerprinter E/UncaughtException: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.mopo.audiofingerprinter-1/base.apk", zip file "/data/app/com.mopo.audiofingerprinter-1/split_lib_dependencies_apk.apk", zip file "/data/app/com.mopo.audiofingerprinter-1/split_lib_slice_0_apk.apk", zip file "/data/app/com.mopo.audiofingerprinter-1/split_lib_slice_1_apk.apk", zip file "/data/app/com.mopo.audiofingerprinter-1/split_lib_slice_2_apk.apk", zip file "/data/app/com.mopo.audiofingerprinter-1/split_lib_slice_3_apk.apk", zip file "/data/app/com.mopo.audiofingerprinter-1/split_lib_slice_4_apk.apk", zip file "/data/app/com.mopo.audiofingerprinter-1/split_lib_slice_5_apk.apk", zip file "/data/app/com.mopo.audiofingerprinter-1/split_lib_slice_6_apk.apk", zip file "/data/app/com.mopo.audiofingerprinter-1/split_lib_slice_7_apk.apk", zip file "/data/app/com.mopo.audiofingerprinter-1/split_lib_slice_8_apk.apk", zip file "/data/app/com.mopo.audiofingerprinter-1/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.mopo.audiofingerprinter-1/lib/arm, /vendor/lib, /system/lib]]] couldn't find "libACRCloudExtrTool.so"
at java.lang.Runtime.loadLibrary(Runtime.java:367)
at java.lang.System.loadLibrary(System.java:988)
at com.mopo.audiofingerprinter.tageditor.ACRCloudExtrTool.<clinit>(ACRCloudExtrTool.java:56)
at com.mopo.audiofingerprinter.tageditor.ACRCloudExtrTool.createFingerprintByFile(ACRCloudExtrTool.java:0)
at com.mopo.audiofingerprinter.tageditor.ACRCloudRecognizer.recognizeByFile(ACRCloudRecognizer.java:129)
at com.mopo.audiofingerprinter.tageditor.TestActivity$RecThread.run(TestActivity.java:84)`
EDIT2
Please note that the feaures I am using libACRCloudEngine.so is working perfectly. So it's libACRCloudExtrTool.so that is the problem here.
put this line in app build.gradle,it represent the path of .so files.
android {
.
.
sourceSets {
main {
jniLibs.srcDirs = ['jniLibs']
}
}
}

How to build and use PJSIP for different architectures than armeabi?

I succesfully compiled PJSIP library for Android. Sample project works without any problems when I build for default architecture armeabi. Now I tried to compile library for arch such as armeabi-v7a and arm64-v8a. Unfortunately when I add libraries to project in appropriate folders (jnLibs/armeabi-v7a and jniLibs/arm64-v8a) application is not starting...
To setup build for different archs I use this command:
NDK_TOOLCHAIN_VERSION=4.9 TARGET_ABI=armeabi-v7a ./configure-android --use-ndk-cflags
I have this error on app launch:
07-04 12:28:46.079 15317-15317/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.futuremind.omili, PID: 15317
java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "getifaddrs" referenced by "/data/app/com.futuremind.omili-1/lib/arm/libpjsua2.so"...
at java.lang.Runtime.loadLibrary(Runtime.java:372)
at java.lang.System.loadLibrary(System.java:1076)
at com.futuremind.omili.MyApp.<clinit>(MyApp.java:293)
at com.futuremind.omili.MainActivity.onCreate(MainActivity.java:87)
at android.app.Activity.performCreate(Activity.java:6289)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2405)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2535)
at android.app.ActivityThread.access$900(ActivityThread.java:155)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1380)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:152)
at android.app.ActivityThread.main(ActivityThread.java:5497)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Thanks for any help! :)
I was able to fix this error by updating the AndroidManifest.xml in "pjsip-apps/src/swig/java/android/app/src/main" to match my android target -- in my case to "23". Then "make clean" and another "make" in "pjsip-apps/src/swig", and rebuilding my app.

Realm causes my app to crash when trying to build a RealmConfiguration

I'm trying to use Realm as a database for high scores in my app. However, when this line of code is called:
realmConfig = new RealmConfiguration.Builder(getActivity().getApplicationContext()).build();
in the Fragment where I'm trying to save the user's score, I get this:
FATAL EXCEPTION: main
Process: com.tommy.mastersproject, PID: 21387
Theme: themes:{com.android.settings=overlay:com.cyngn.hexo, default=overlay:system, iconPack:system, fontPkg:system, com.android.systemui=overlay:system, com.android.systemui.navbar=overlay:system}
java.lang.NoClassDefFoundError: Failed resolution of: Lio/realm/RealmConfiguration$Builder;
at com.tommy.mastersproject.fragments.MemoryRecallFragment.onCreate(MemoryRecallFragment.java:144)
at android.support.v4.app.Fragment.performCreate(Fragment.java:1951)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1029)
at android.support.v4.app.BackStackRecord.setLastIn(BackStackRecord.java:779)
at android.support.v4.app.BackStackRecord.calculateFragments(BackStackRecord.java:802)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:660)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1617)
at android.support.v4.app.FragmentController.execPendingActions(FragmentController.java:339)
at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:601)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1238)
at android.app.Activity.performStart(Activity.java:6268)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2413)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2510)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1363)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5461)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: java.lang.ClassNotFoundException: Didn't find class "io.realm.RealmConfiguration$Builder" on path: DexPathList[[dex file "/data/data/com.tommy.mastersproject/files/instant-run/dex/slice-support-annotations-23.4.0_d80f4a0fc2ae8e1f7cf76e4c536a48795da28487-classes.dex", dex file "/data/data/com.tommy.mastersproject/files/instant-run/dex/slice-slice_9-classes.dex", dex file "/data/data/com.tommy.mastersproject/files/instant-run/dex/slice-slice_8-classes.dex", dex file "/data/data/com.tommy.mastersproject/files/instant-run/dex/slice-slice_7-classes.dex", dex file "/data/data/com.tommy.mastersproject/files/instant-run/dex/slice-slice_6-classes.dex", dex file "/data/data/com.tommy.mastersproject/files/instant-run/dex/slice-slice_5-classes.dex", dex file "/data/data/com.tommy.mastersproject/files/instant-run/dex/slice-slice_4-classes.dex", dex file "/data/data/com.tommy.mastersproject/files/instant-run/dex/slice-slice_3-classes.dex", dex file "/data/data/com.tommy.mastersproject/files/instant-run/dex/slice-slice_2-classes.dex", dex file "/data/data/com.tommy.mastersproject/files/instant-run/dex/slice-slice_1-classes.dex", dex file "/data/data/com.tommy.mastersproject/files/instant-run/dex/slice-slice_0-classes.dex", dex file "/data/data/com.tommy.mastersproject/files/instant-run/dex/slice-library-2.4.0_e0d22a6e7ea9a4d2326a0c8c16bbc09d4d04442c-classes.dex", dex file "/data/data/com.tommy.mastersproject/files/instant-run/dex/slice-internal_impl-23.4.0_bd67bdb6ef0c094e8f4157e2567e8b30b9d0dd7f-classes.dex", dex file "/data/data/com.tommy.mastersproject/files/instant-run/dex/slice-com.jakewharton-butterknife-8.0.1_9246a0d023a2de89ba20a84f0fb1ecc6b733b004-classes.dex", dex file "/data/data/com.tommy.mastersproject/files/instant-run/dex/slice-com.code-troopers.betterpickers-library-3.0.0_f98f8b23c6650d93d8479a647f8f2162db8834e8-classes.dex", dex file "/data/data/com.tommy.mastersproject/files/instant-run/dex/slice-com.astuetz-pagerslidingtabstrip-1.0.1_474986b4f5d06e547dc72e3bf0988a95fa9d3973-classes.dex", dex file "/data/data/com.tommy.mastersproject/files/instant-run/dex/slice-com.android.support-support-vector-dr
I've also tried using
realm = Realm.getDefaultInstance();
but without any luck.
From a quick Google search, there have been similar complaints which were due to Realm's poor compatibility with the Android multidex and for not being up-to-date with Gradle, but I'm currently running Gradle 2.1.2.
I am also using Gradle 2.1.2 and Realm is working perfectly fine, problem could be with Instant Run, Did you try loading the project without Instant Run? If not disable it(In Android studio -> Preferences -> Build, Execution, Deployment -> Instant Run), clean the project and run it again.
If it does not work, share the actual code where you are creating RealmConfiguration and using Realm.

Android: Couldn't load mupdf

I am having an (Android Studio - Gradle) Cordova (3.6.4) project.
In my app there can be a list of pdf files which should be shown with mupdf.
But I always get the following error message:
06-10 15:04:38.365 5940-5940/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: de.dil.DSM, PID: 5940
java.lang.UnsatisfiedLinkError: Couldn't load mupdf from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/de.dil.DSM-2.apk"],nativeLibraryDirectories=[/data/app-lib/de.dil.DSM-2, /vendor/lib, /system/lib]]]: findLibrary returned null
at java.lang.Runtime.loadLibrary(Runtime.java:358)
at java.lang.System.loadLibrary(System.java:526)
at com.artifex.mupdfdemo.MuPDFCore.<clinit>(MuPDFCore.java:14)
at de.dil.DSM.DSM.loadFile(DSM.java:216)
at de.dil.DSM.xviewer$6.run(xviewer.java:102)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5001)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
The java files from mupdf seems to be correctly imported.
It seems to be, that it is "just" the "libmupdf.so" which isn't correctly imported.
The libmupdf.so files are in the following directories:
libs/armeabi/libmupdf.so
libs/armeabi-v7a/libmupdf.so
There is also a c mupdf file here: jni/mupdf.c
Is there anything which I especially need to configure in the settings.gradle or in the build.gradle?
Thanks ahead!!!!
Put your .so files in a jniLibs folder
>src
>main
>jniLibs
>armeabi
|libmupdf.so
>armeabi-v7a
|libmupdf.so
The solution was to add this:
jniLibs.srcDirs = ['libs']
To the existing sourceSets in the build.gradle!

Categories

Resources