Optimizing APK Size for Custom Build on Top of DHIS2 Android Capture App

Hello everyone,

We are currently developing a custom APK on top of the DHIS2 Android Capture App to address specific PreHospital implementation needs. One of the main challenges we’re facing is the large APK size, which makes distribution difficult in low-bandwidth environments.

We’d really appreciate advice and shared experiences from the community on the following:

  1. Code and resource shrinking – Has anyone successfully reduced the Capture App (or custom forks) APK size using R8/ProGuard minification (minifyEnabled = true) and resource shrinking (shrinkResources = true)? If so, what impact did it have on the final build size, and were there any issues with missing classes or resources?

  2. Large assets – Are there recommended best practices for handling or optimizing large assets (e.g., media, images, fonts) within the Capture App context?

  3. Gradle configuration – We’re currently experimenting with these optimizations in the app/build.gradle.kts release build type and would value insights from anyone who has managed to deploy a lightweight build of the Capture App.

Any guidance, lessons learned, or references to previous work in this area would be greatly appreciated.

Thanks in advance!

1 Like

Hi @Kenyuri

It’s possible that your usecase is very specific and I expect that not so many people need to fork the app similarily to what your usecase needed, so I’m not sure how many people would be able to provide you with that info. That is if you’re not the first to look into this

The APK itself is about 79MB and when I installed it on my android phone, it’s about 207MB (without the data and cache). I’m curious what is the size you’re expecting to reduce it to?

Considering this usecase, I’m hoping you’d continue to share updates with the community about your progress!

Thanks!

Hi @Kenyuri , sorry for the late reply.

We worked on reduce the APK size for 3.3.0, maybe you can take a look in develop branch the changes we made.

1 Like