I was following the instruction given by quick blox as below: https://quickblox.com/developers/Sample-webrtc-android
dependencies
{
compile 'com.quickblox:quickblox-android-sdk-videochat-webrtc:3.3.0'
}
Initially my apk size is 9MB but when I integrated quickblox video chat in my application, apk size increased to 45 MB due to below platforms of different .so files:
>arm64-v8a
>armeabi-v7a
>x86
>x86_64
libraries - libjingle_peerconnection_so.so
Is there any way or suggestions to reduce apk size?
I was looking into the sample code provided by QuickBlox and found that you can save upto 10 MB of apk but you have to build 4 apks. You can check the gradle file
/*There is code for excluding some native libs (it useful if you need reduce apk size and want
build apk only for specific platform). This method allows you to achieve savings about 10MB
of apk's size (but you need build 4 different apks). */
packagingOptions {
exclude '**/armeabi-v7a/libjingle_peerconnection_so.so'
exclude '**/arm64-v8a/libjingle_peerconnection_so.so'
exclude '**/x86_64/libjingle_peerconnection_so.so'
exclude '**/x86/libjingle_peerconnection_so.so'
}
About Multiple APKs
Different Android handsets use different CPUs which in turn support different instruction sets. Each combination of CPU and instruction sets has its own Application Binary Interface, or ABI
armeabi-v7a
arm64-v8a
x86_64
x86
These are ABI
building 4 apks meant you can create apk for these 4 ABI's separately. The main idea is to not include the libraries which are not meant for specific ABI thus reducing the size by including only the libraries which are required for that ABI
e.g.
splits {
abi {
enable true
reset()
include 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a' //select ABIs to build APKs for
universalApk true //generate an additional APK that contains all the ABIs
}
}
Update:
How to upload multiple APKs to PlayStore?
this question has already been asked on SO. please check this question
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With