Closed omkar-tenkale closed 3 years ago
@omkar-tenkale
This seems to be a dependency problem of apache harmony. The Stacktrace says that "liblcmm.so" could not be found. As I understand the code, this is a JNI part of apache harmony. So you probably have to bundle the native library to your App.
I have no idea how this is done, but I found this: (German) https://wissensbasis.net/4198939/droidText-unstaisfiedLink-Fehler-beim-Erstellen-der-Image-Instanz (English) https://stackoverflow.com/questions/24357687/how-to-include-so-library-in-android-studio
So I think this is not really a bug in OpenPDF.
It seems like newer API levels of android is missing this or not allowing the applications to reach it, using a device with lower api level solves this which makes me wonder if it really is a problem that should be solved by bundling the library manually?
It seems like newer API levels of android is missing this or not allowing the applications to reach it, using a device with lower api level solves this which makes me wonder if it really is a problem that should be solved by bundling the library manually?
Google play console is rising target sdk api level, so this will become an issue in no-time. Also i saw on my phone (Google pixel 4xl android 11) that PNG file works as expected, JPG will not work.
Include this so library is not easy (at least for me) since i cannot find it anywhere...
Hello. Will take a look at the problem. Sorry for the delay (it's been a year :D), but I've just now read your issue, GitHub didn't sent me email notifications.
yes, this native library is missing from newer Android because google switched from Harmony to OpenJDK. There are two C libraries used: lcmm and jpegdecoder.
Found versions of those two here and here. I will search for newer versions, then I will compile them, change names to prevent name collision on old android versions and bundle them into android-awt library.
Problem is, I wasn't able to replicate the issue. @Azaratur Can you give me a picture that is not working?
Yes i knew about Harmony/OpenJDK. I did also search for newer version but without luck.. I guess it could be replaced with OpenJDK since i found almost the same methods, not sure it will work.
As far as i know it crash with any android 30 if the app is compiled on targetsdk 30 and with any jpg image. I did test on Pixel 2 XL and Pixel 4 XL both android 11. Both crashes with any png using an app compiled on targetsdk 30. Had different results on targetsdk 28.
I've bundled lcmm and lcms C code into the library. I could also bundle this and this. But I don't know if it's important for the current issue.
@Azaratur I still couldn't replicate, but I made an update with the changes. Can you please import the latest release:
repositories {
maven { url "http://maven.andob.info/repository/open_source" }
}
implementation 'com.github.librepdf:openpdf:1.3.24'
implementation 'ro.andob.androidawt:androidawt:1.0.4'
Then test your app and tell me if now it works or not?
Will test it in a bit.
Tested it and now it's working as expected! Thank you so much.
great! you're welcome
While using OpenPDF in android
Theres this error occuring when converting images to pdf as follows;
Tried adding
but same error