libreliodev / android

Android Customizable Reader - Librelio Digital Publishing Suite
www.librelio.com
226 stars 129 forks source link

The app crashes when I use my own libmupdf.so #208

Closed bagusflyer closed 10 years ago

bagusflyer commented 10 years ago

Hi, my app crashes when I use my own libmupdf.so. The error message is something like:" The native function doesn't exist in MuCore.openFile()". I guess it because I used my own libmupdf.so (I just compiled it by myself. The reason I compiled it is because I want to use x86 library. Anyway it crashes even when I'm using my own armeabi-v7a library.)

Did you compile your mupdf with some special flag? Thanks

bagusflyer commented 10 years ago

I mean did you change anything in mupdf core (native) part? And what is the version of mupdf you based on in your project?

intrications commented 10 years ago

I've no idea because I wasn't involved in the project at the beginning. You may be able to tell by looking through the git history.

I do know that the version of MuPDF used is quite old so I'm not surprised that you can't just drop in your compiled files. Maybe the Java files need updating as well but I don't know if they were customized. This line might be relevant:

https://github.com/libreliodev/android/blob/master/src/com/artifex/mupdf/MuPDFCore.java#L34

bagusflyer commented 10 years ago

Thanks for your reply. Do you consider to upgrade the mupdf part? Because the performance of new mupdf (1.3) is much better. I'll look into it when I have time.

intrications commented 10 years ago

@bagusflyer Yes, an update to MuPDF would be great. But, as discussed on http://stackoverflow.com/questions/17594656/show-two-pages-on-landscape-mode-on-mupdf/17597401?noredirect=1#comment33691832_17597401, the changes to show two pages in landscape would need to be preserved.

bagusflyer commented 10 years ago

I managed to integrate the mupdf 1.3 (the latest version). The only change for libreliodev is the package name. I changed it from com.artifex.mupdf to com.artifex.mupdfdemo, then everything is fine. I even can use x86 libmupdf.so in Genymotion emulator now. Do you want to do corresponding modification? I can send you the latest so files. (I think new mupdf is much faster.)

intrications commented 10 years ago

Can you send a pull request with the changes?

bagusflyer commented 10 years ago

The other way is to change the mupdf.c and compile the mupdf library. I think this is simpler. But I have a problem to pull request because I'm not using Eclipse. Instead I'm using Android Studio to compile my application. I think the easiest way is I send you the compiled library. Is that ok?

intrications commented 10 years ago

@bagusflyer I don't have much experience with using native code on Android. Do you need to use the Android NDK to compile MuPDF?

I usually use Android Studio as well, but have to use Eclipse for this project.

You can send any files you have changed to the email address on my github profile page: https://github.com/intrications

intrications commented 10 years ago

As @bagusflyer suggested updating mudpf.c to use com/artifex/mupdf rather than com/artifex/mupdfdemo allowed me to compile and just replace the so files in the libs folder.

Pushed updated libraries in 6eb1e6e42a27afc225fc34de358a588ff8a4bc34

suntehnik commented 10 years ago

@bagusflyer I did the initial mupdf integration with the project. I did some tests with latest mupdf release and found a lot of OOM exceptions there. That's why the project is stick with the old one.

harveyslash commented 10 years ago

hello. I am compiling mupdf 1.5 ,but it does not work with genymotion emulator. What changes should i make before rebuilding the source ? I am a little new to android, thank you

suntehnik commented 10 years ago

You should use mupdf bundled with this project. Other versions will not work.

harveyslash commented 10 years ago

but isnt this version old ?

suntehnik commented 10 years ago

Doesn't matter how it's old. It works. That matters. Newer versions has a lot of functionality and bugs. One of the most important - OutOfMemory exceptions. 16 èþíÿ 2014 ã., â 11:36, harveyslash notifications@github.com íàïèñàë(à):

but isnt this version old ?

— Reply to this email directly or view it on GitHub.

harveyslash commented 10 years ago

it runs on my physical nokia x. it just doesnt run on the emulator. it runs on bluestacks too.

so, should i be concerned about it not running on other physical devices ?

suntehnik commented 10 years ago

Because Genymotion use x86 architecture and mupdf was not compiled for that. Use emulator bundled with android sdk.

16 èþíÿ 2014 ã., â 11:42, harveyslash notifications@github.com íàïèñàë(à):

it runs on my physical nokia x. it just doesnt run on the emulator.

— Reply to this email directly or view it on GitHub.

harveyslash commented 10 years ago

another thing i just found out, I get ExceptionInitializerError if i run the mupdf source as a library project. error is, could not load mupdf , findlib returned null. could you please help ?

suntehnik commented 10 years ago

Check you have .so in final APK file. Just unzip it as ordinary zip file and check libs folder inside. I’m not sure you can use original MuPDF as a library project. You guess must copy libs manually.

16 èþíÿ 2014 ã., â 13:31, harveyslash notifications@github.com íàïèñàë(à):

another thing i just found out, I get ExceptionInitializerError if i run the mupdf source as a library project. error is, could not load mupdf , findlib returned null. could you please help ?

— Reply to this email directly or view it on GitHub.

harveyslash commented 10 years ago

i did that, still same error

bagusflyer commented 10 years ago

That’s because the c jnl interface has been changed. You can change the name of the functions. (Sorry, I don’t have the source code with me now. I can’t tell you the exact name of the function.)

在 2014年6月19日,下午07:34,harveyslash notifications@github.com 写道:

i did that, still same error

— Reply to this email directly or view it on GitHub.

tejalpandya commented 9 years ago

I m using mupdf library for pdf reader writer. but problem is that its not got highlighted text in lolipop version. so can u suggest which library is latest? Give me reply.

intrications commented 9 years ago

@tejalpandya

I have no idea. The MuPDF java code was embedded in the app and altered so updating the MuPDF library is probably more complicated than just updating MuPDF.

There are open issues to update the MuPDF library used in the app and to make sure it works on all supported versions of Android.

277 #281

tejalpandya commented 9 years ago

can u give me mupdf 1.7 latest version link ?