Reduce APK size #771
Replies: 5 comments
-
+1 This was also requested by the users at our Thailand training programs. |
Beta Was this translation helpful? Give feedback.
-
v2.1.0 (#358) should reduce the APK size for Arm devices to 50Mb. The release candidates linked in the issue though are universal builds which continue to be 90Mb+, the optimized build won't be made until we complete testing and release v2.1.0 |
Beta Was this translation helpful? Give feedback.
-
I've also setup Google Play Store integration so that Google Play installs should be even smaller, since they will target the specific device being used. |
Beta Was this translation helpful? Give feedback.
-
Great, Thanks for all the work. |
Beta Was this translation helpful? Give feedback.
-
The size of the APK increased again when we upgraded the nodejs-mobile version we are using, and I've made some changes in #606 that bring the size back to 56.6Mb. This is important because we are going to start distributing on the playstore a multi-arch build (for both arm7 and arm64), since that allows the upcoming peer-to-peer upgrades feature to work across both 32-bit and 64-bit devices. Other steps we can take to reduce size:
|
Beta Was this translation helpful? Give feedback.
-
Currently the Mapeo APK size is 89.1Mb. Reducing the size will reduce install time for users with slow internet, and reduce space taken up on the device.
The main cause of the large size is supporting different architectures in the same APK. One way to resolve this is to distribute the app through the Google Play store, and uploading an "Android App Bundle" (aab) and allowing Google Play to generate an APK depending on the architecture of the device.
However, this does not solve the problem for users downloading an APK for offline install. It will likely cause confusion for users if there are different versions, since many users do not know what architecture their phone has.
The main two architectures for Android are Arm v7, which is 32-bit, and Arm_64, which is 64-bit. The APK currently includes x86 and x86_64 builds. This is useful for running in an emulator on a x86 machine, but few (any?) phones run on x86. I think it is mainly ChromeBooks (which now run Android apps) which would require x86.
Looking at the bundle size of a current APK with https://apkanalyzer.xyz:
libv8android.so
(7.23 MB),libnode.so
(6.52 MB) andlibmapbox-gl.so
(1.79 MB).libv8android.so
is large because of the bundled Intl, which is required for multi-language support. The other two are also needed..dex
) is about 4Mb which could probably be reduced by using ProGuard to remove unused code, but it is not a large % of current size.Therefore, probably the best and easiest way to reduce size is to only build the APK for Arm (32-bit and 64-bit), and then strip un-used code from Nodejs assets. This would get the APK size down to about 43Mb. If we built per-architecture APKs for Google Play they would probably be about 23Mb each. Further work with ProGuard and reducing unused JS code could maybe bring this down to about 40/20Mb.
Beta Was this translation helpful? Give feedback.
All reactions