MuPdf Android JNI 库非常大

MuPdf Android JNI library is very large

如此处所述 (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)。 APK 中的 *.so 文件大小超过 12 MB!

在我们几个月前将 MuPdf 更新到最新版本(即 Document Viewer 2.5 及更早版本)之前,每个 *.so 文件仅占 3.9 MB。

你能解释一下字面意义上的 300% 的增长吗?有什么我们可以更改以进一步压缩我们的 JNI 库吗?

1) 分裂.apk

NDK support in AndroidStudio and choosing between Android Studio and Eclipse

2) 最小化 MuPDF

您自己从源构建库并根据平台生成多个 .so 是绝对必要的(源包含关于如何实现这一点的强烈提示,所以我不会详细介绍)。

然后尝试添加

LOCAL_CFLAGS += -DNOCJK

Core.mk 中排除 .so 中的字体(没错,resources\fonts\droid 中 9 MB 的字体现在将从库中删除)。

刚从 9266 kB 到 2155 kB 解压

编辑: 然后这又取决于您的目标市场是什么。您可能需要保留它们。CJK = Chinese, Japanese, Korean