MuPDF Library not working on X86 architectures - android

This question was already asked by someone, But there i can't find any clues about the issue. I am using MuPDF library to open and preview the .pdf files in our Android application. It's working fine other than few X86 architecture devices. I got the following issue
Fatal Exception: java.lang.UnsatisfiedLinkError: dlopen failed: "/data/app/com.demo-1/lib/x86/libmupdf.so" has unexpected e_machine: 40
at java.lang.Runtime.loadLibrary(Runtime.java:371)
at java.lang.System.loadLibrary(System.java:988)
at com.artifex.mupdfdemo.MuPDFCore.(MuPDFCore.java:19)
at com.demo.openwith.OpenwithFragment.openFile(OpenwithFragment.java:789)
at com.demo.openwith.OpenwithFragment.openPDF(OpenwithFragment.java:671)
at com.demo.openwith.OpenwithFragment.onCreateView(OpenwithFragment.java:346)
at android.app.Fragment.performCreateView(Fragment.java:2053)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:894)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1067)
at android.app.BackStackRecord.run(BackStackRecord.java:834)
at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1452)
at android.app.Activity.performStart(Activity.java:6047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2306)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2405)
at android.app.ActivityThread.access$800(ActivityThread.java:154)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1306)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5292)
at java.lang.reflect.Method.invoke(Method.java)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
previously i have used the old library(.so) of the MuPDF. Now i have updated the recent library, even i am getting the same issue. Can anyone help me to find the reason and fix the issue.

create libs folder in app/src/main
then create folder x86 download this file and insert it
https://github.com/minaairsupport/MuPDF_Android_Studio/blob/master/app/src/main/jniLibs/x86/libmupdf_java.so

Related

Can't add .so file to Android Studio 3.5.3 using jniLibs

I'm trying to add a .so file to a new Android project. I'm using Android Studio 3.5.3. I've done what was recommended here and here ; so I created folders (jniLibs/arm64-v8a, etc) in src/main and added this to app/build.gradle:
sourceSets {
main {
jniLibs.srcDirs = ['src/main/jniLibs']
}
}
I placed the libhl.so file in /app/src/main/jniLibs/arm64-v8a (yes, 64-bit should be ok). The project will compile just fine, but on execution it will show the following error in logcat:
02-17 10:25:31.719 3691-3691/com.example.bmdtest03 E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.bmdtest03, PID: 3691
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.example.bmdtest03-2/base.apk"],nativeLibraryDirectories=[/data/app/com.example.bmdtest03-2/lib/x86_64, /vendor/lib64, /system/lib64]]] couldn't find "libhl.so"
at java.lang.Runtime.loadLibrary(Runtime.java:366)
at java.lang.System.loadLibrary(System.java:989)
at com.example.bmdtest03.MainActivity.<clinit>(MainActivity.java:14)
at java.lang.reflect.Constructor.newInstance(Native Method)
at java.lang.Class.newInstance(Class.java:1572)
at android.app.Instrumentation.newActivity(Instrumentation.java:1065)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2199)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Conclusion: the file is there, the source is updated in build.gradle, what am I missing?
You can manually generate the .so file with NDK . Then you can add the lib.so file in your jni folder.
Add the NDK path to your local.properties.
Refer this page : https://developer.android.com/studio/projects/gradle-external-native-builds
If its not works. You can create javah then you can access it.
Link to make javah : https://developer.android.com/training/articles/perf-jni

Adobe Android ANE support armeabi

I am integrating Twilio video in android with my adobe air app. I can successfully add video sdk in ane but twilio video sdk uses com.getkeepsafe.relinker SDK.
This SDK gives me below error
Process: air.TestApp, PID: 585
java.lang.RuntimeException: Unable to start activity ComponentInfo{air.TestApp/com.nethram.video.views.MainActivity}: com.getkeepsafe.relinker.MissingLibraryException: lib/armeabi/libjingle_peerconnection_so.so
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2456)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2539)
at android.app.ActivityThread.access$900(ActivityThread.java:159)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1384)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:152)
at android.app.ActivityThread.main(ActivityThread.java:5507)
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: com.getkeepsafe.relinker.MissingLibraryException: lib/armeabi/libjingle_peerconnection_so.so
at com.getkeepsafe.relinker.ApkLibraryInstaller.installLibrary(ApkLibraryInstaller.java:85)
at com.getkeepsafe.relinker.ReLinkerInstance.loadLibraryInternal(ReLinkerInstance.java:180)
at com.getkeepsafe.relinker.ReLinkerInstance.loadLibrary(ReLinkerInstance.java:136)
at com.getkeepsafe.relinker.ReLinker.loadLibrary(ReLinker.java:70)
at com.getkeepsafe.relinker.ReLinker.loadLibrary(ReLinker.java:51)
at com.twilio.video.MediaFactory.instance(MediaFactory.java:47)
at com.twilio.video.LocalAudioTrack.create(LocalAudioTrack.java:98)
at com.twilio.video.LocalAudioTrack.create(LocalAudioTrack.java:75)
at com.nethram.video.views.MainActivity.createAudioAndVideoTracks(MainActivity.java:260)
at com.nethram.video.views.MainActivity.onCreate(MainActivity.java:131)
at android.app.Activity.performCreate(Activity.java:6304)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2409)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2539)
at android.app.ActivityThread.access$900(ActivityThread.java:159)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1384)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:152)
at android.app.ActivityThread.main(ActivityThread.java:5507)
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)
When I look into this error, I think this package uses armeabi split.
Is there any method to resolve this issue?
When packaging an ANE that uses an SDK that relies on native (jni) libraries you need to ensure they are also included in your ANE package. These must be placed in the libs directory in the appropriate architecture directory (armeabi etc).
If dealing with an aar file, then you can simply check if it contains a jni directory and copy it's contents to the libs directory in your ANE platform implementation.
You should end up with the following structure:
[ANDROID_PLATFORM]/
your_ane_implementation.jar
your_ane_res/
libs/
armeabi/
libXXXXX.so
armeabi-v7a/
libXXXXX.so
...

Mupdf lib crash on Samsung Galaxy Edge 6

I have following libs in my project :
Armeabi , Armeabi-v7a , mips , x86 they all have libmupdf.so while Samsung device looking for lib/arm64.
I am getting below crash on Samsung Galaxy Edge 6 .
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.engagebeyond.sasol-1/base.apk"],nativeLibraryDirectories=[/data/app/com.engagebeyond.sasol-1/lib/arm64, /vendor/lib64, /system/lib64]]] couldn't find "libmupdf.so"
at java.lang.Runtime.loadLibrary(Runtime.java:366)
at java.lang.System.loadLibrary(System.java:988)
at com.artifex.mupdflib.MuPDFCore.<clinit>(MuPDFCore.java:14)
at com.artifex.mupdflib.MuPDFActivity.openFile(MuPDFActivity.java:233)
at com.artifex.mupdflib.MuPDFActivity.onCreate(MuPDFActivity.java:445)
at android.app.Activity.performCreate(Activity.java:6500)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1120)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3072)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3218)
at android.app.ActivityThread.access$1000(ActivityThread.java:198)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1676)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:6837)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)
Do any one known how i can build lib for arm64 ?
As this phone will run 32bit libraries, one option is to just disable 64 for your application, which will then allow the Armeabi-v7a library to be used.
The easiest way to do this is using the abiFilter setting, see https://stackoverflow.com/a/30799825/292166

Conflicting HERE sdk and Fresco library

I've just stumbled upon a very particular issue. There seem to be a conflict between some native libraries (i assume). When using the HERE premium SDK for android and Facebook's Fresco library in the same project will result in HERE map not rendering. As soon as i remove the Fresco library from my project it behaves and renders as it should.
Of course the simplest solution is not to use Fresco but i rather not do that.
Anyone any idea what is going on or how to solve this?
This is the error it throws:
org.xml.sax.SAXParseException: Unexpected end of document
at org.apache.harmony.xml.parsers.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:125)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:107)
at com.nokia.maps.fh.a(XmlToDocParser.java:24)
at com.nokia.maps.ResourceManager.a(ResourceManager.java:212)
at com.nokia.maps.ResourceManager.a(ResourceManager.java:138)
at com.nokia.maps.as.<init>(GLConfigHelper.java:38)
at com.nokia.maps.y.a(BaseTextureView.java:61)
at com.nokia.maps.y.<init>(BaseTextureView.java:54)
at com.nokia.maps.bx.<init>(MapTextureView.java:36)
at com.here.android.mpa.mapping.MapView.a(MapView.java:320)
at com.here.android.mpa.mapping.MapView.<init>(MapView.java:169)
at com.nokia.maps.bk.a(MapFragmentImpl.java:143)
at com.here.android.mpa.mapping.MapFragment.onCreateView(MapFragment.java:147)
at android.app.Fragment.performCreateView(Fragment.java:2114)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:875)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1060)
at android.app.FragmentManagerImpl.addFragment(FragmentManager.java:1162)
at android.app.FragmentManagerImpl.onCreateView(FragmentManager.java:2131)
at android.app.Activity.onCreateView(Activity.java:5751)
at android.support.v4.app.BaseFragmentActivityHoneycomb.onCreateView(BaseFragmentActivityHoneycomb.java:34)
at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:78)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:740)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:813)
at android.view.LayoutInflater.inflate(LayoutInflater.java:511)
at android.view.LayoutInflater.inflate(LayoutInflater.java:415)
at com.justpark.ondemand.ui.activity.BaseActivity.setContentView(BaseActivity.java:20)
at com.justpark.ondemand.ui.activity.TurnByTurnActivity.onCreate(TurnByTurnActivity.java:145)
at android.app.Activity.performCreate(Activity.java:6500)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1120)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3072)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3218)
at android.app.ActivityThread.access$1000(ActivityThread.java:198)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1676)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:6837)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)
Seems Fresco has a file called eglconfig.xml, that file must also be present in fresco resources or in your app? If you delete this xml file from the resource tree, does it help?
/I'm from the HERESDK team and thanks for the feedback!

Android BarcodeScanner library crash in 64bits devices

We have an application using the Zbar library from BarcodeScanner with gradle:
compile 'me.dm7.barcodescanner:zbar:1.8.2'
Scanning works fine in all the devices except for those with 64bit. When we launch the scanner the screen turn black and we receive an exception:
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/my.package.name-2/base.apk"],nativeLibraryDirectories=[/data/app/my.package.name-2/lib/arm64, /vendor/lib64, /system/lib64]]] couldn't find "libiconv.so"
at java.lang.Runtime.loadLibrary(Runtime.java:366)
at java.lang.System.loadLibrary(System.java:989)
at me.dm7.barcodescanner.zbar.ZBarScannerView.(ZBarScannerView.java:31)
at my.package.name.activity.BarcodeActivity.onCreate(BarcodeActivity.java:19)
at android.app.Activity.performCreate(Activity.java:6374)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2767)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2879)
at android.app.ActivityThread.access$900(ActivityThread.java:182)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1475)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:6141)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
It seems to be fixed in 1.8.4.
Try using version 1.9
compile 'me.dm7.barcodescanner:zbar:1.9'

Categories

Resources