SSR SSR - 2 years ago 91
Android Question

barteksc/AndroidPdfViewer massive APK Size

We included this AndroidPdfViewer library to support viewing of PDF reports in the app. It lead to massive increase in APK size from 4.7Mb to 20.1Mb .

Is there a way to reduce this size. Let me know where and what to tinker around to help or solve this.

I am familiar with proguard and have it configure for my app with reasonable success.

Answer Source

Why resulting apk is so big?

Android PdfViewer depends on PdfiumAndroid, which is set of native libraries (almost 16 MB) for many architectures. Apk must contain all this libraries to run on every device available on market. Fortunately, Google Play allows us to upload multiple apks, e.g. one per every architecture. There is good article on automatically splitting your application into multiple apks, available here. Most important section is Improving multiple APKs creation and versionCode handling with APK Splits, but whole article is worth reading. You only need to do this in your application, no need for forking PdfiumAndroid or so.


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download