简体   繁体   中英

MuPdf Android JNI library is very large

As described here ( https://github.com/sufficientlysecure/document-viewer/issues/88 ) we're facing the problem that the JNI library that is part of the MuPdf Android demo is really large. In this case, this affects the size of the Document Viewer app ( https://f-droid.org/repository/browse/?fdid=org.sufficientlysecure.viewer ). The *.so files in the APK are more than 12 MB in size!

Before we updated MuPdf to the latest version a few months ago (ie version 2.5 and earlier of Document Viewer), the *.so files accounted for only 3,9 MB each.

Can you explain this increase of literally 300%? Is there anything we can change to compress our JNI libs further?

1) Splitting .apk

NDK support in AndroidStudio and choosing between Android Studio and Eclipse

2) Minimizing MuPDF

It is absolutely essential you build the library from sources yourself and generate multiple .so s based on platform (the sources contain strong hints on how to achieve this so I'll not go into details).

Then try adding

LOCAL_CFLAGS += -DNOCJK

in Core.mk to exclude fonts from the .so (that's right, the 9 MB worth of fonts from resources\\fonts\\droid will now be stripped from the library).

Just went from 9266 kB to 2155 kB unpacked .

EDIT: Then again it depends what your target market is. You might need to keep those in. CJK = Chinese, Japanese, Korean

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM