Realm adding extra size to my apk

谁都会走 提交于 2019-12-03 03:10:26

You can use abi splits to reduce size of APK.

Normally (without splits) it includes files to support almost all architectures (ARM7, ARMv7, ARM64, x86, MIPS) This is why it's too big.

With abi splits, android studio will generate APK for each architecture, and each APK will not include files for any other architecture

Just add below section in gradle file. Also check this realm documentation

splits {
    abi {
        enable true
        reset()
        include 'armeabi', 'armeabi-v7a', 'arm64-v8a', 'mips', 'x86', 'x86_64'
    }
}

Important

Each distrubtion(APK) will only work on appropriate device. So we can say, app-x86_64-release.apk will not work on armeabi-v7a architectured device. If you try, you'll face Failure [INSTALL_FAILED_NO_MATCHING_ABIS] error.

You can also check these documentations.

samuel owino

It is possible to reduce the Apk size, but first the quickest most immediate way to do this is to remove the packages in realm API that your application is not using or targeting. This way your apk size will decline significantly, also try compressing any resources and multimedia your app is using.
A more extreme solution is to integrate with firebase and let some of your content load into the app in real time and not on deployment.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!