6

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?

Ranjithkumar
  • 16,071
  • 12
  • 120
  • 159
VenSan
  • 459
  • 3
  • 10
  • 1
    any solution for this? I need also same solution – Ranjithkumar Feb 14 '18 at 05:02
  • Which modules of webrtc you are using? Is there any particular single module or multiple module ? Modules od WEBRTC are core module, users module, messages module, content module, chat module and videochat-webrtc module . – Upendra Shah Feb 21 '18 at 05:14

2 Answers2

5

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

Sahil Manchanda
  • 9,812
  • 4
  • 39
  • 89
  • This looks right solution. Can you give explanation about build "4 different apks" I will give bounty immediately. Thanks for your answer :) – Ranjithkumar Feb 20 '18 at 07:05
  • @RanjithKumar i have added explanation about building 4 different apk. please check – Sahil Manchanda Feb 20 '18 at 07:18
  • Thanks for updated answer. I will check & offer bounty tonight. Please give me time for check this – Ranjithkumar Feb 20 '18 at 07:20
  • I am not tested. But I hope it works. Please give me how to upload these 4 different APKs in play store? – Ranjithkumar Feb 21 '18 at 04:49
  • 1
    Thanks for your effort – Ranjithkumar Feb 21 '18 at 06:09
  • We can do with split option but it's again huge process to maintain or upload 4 apk's every-time when we push update to playstore. Is there any other way where we can use some other lib or some optimization? – VenSan Feb 23 '18 at 12:09
  • @VenSan according to their sample code this seems the only way. I have integrated Sinch Video Call in one of my app and its size was increased around 20 MB. If you can switch try [Sinch](https://www.sinch.com/) – Sahil Manchanda Feb 23 '18 at 12:26
  • @Sahil can we do the same split process for Sinch to reduce more size? – VenSan Feb 23 '18 at 12:38
  • 1
    @VenSan i haven't tried but they seem to support this for ios. have a [look](https://www.sinch.com/docs/video/ios/#noteonsinch.frameworkfilesizevs.linkedsize) – Sahil Manchanda Feb 23 '18 at 12:52
-2

It mandatory to add those files if you want to add video call or audio call capabilities to your application. With shrinking your apk size there are a lot of articles about it but there is not too much regarding the jnilibs with quickblox.

Google Developer Docs on shrinking size

Hope it helps.

Norris Boateng
  • 357
  • 1
  • 5
  • 18