Er. Kaushik Kajavadara
Er. Kaushik Kajavadara

Reputation: 1667

Twilio android sdk increased app size 36 MB can it be reduced?

My app size was 26MB before integrating below list of dependency and jar files in my project. But after adding these it is now 62MB. can it be reduced in any possible way?

Build.gradle file:

compile 'com.twilio:client-android:1.2.14'
compile 'com.twilio:conversations-android:0.12.1'

libs folder:

ion-2.1.8.jar
koushikdutta-async-2.1.8.jar

Please help your reply world be appreciated.

Upvotes: 2

Views: 1203

Answers (3)

Er. Kaushik Kajavadara
Er. Kaushik Kajavadara

Reputation: 1667

Finally, I found very good solution that can split apk with Minimum size possible:

I added following code in my build.gradle file and now my app maximum size is 28MB(Reduced from 62MB).

splits {
         density {
             enable true
             exclude "ldpi", "tvdpi", "xxxhdpi"
             compatibleScreens 'small', 'normal', 'large', 'xlarge'
         }

        abi {
            enable true
            include 'x86', 'armeabi-v7a', 'arm64-v8a', 'x86_64'
            exclude "armeabi", "mips", "mips64"
            universalApk true
        }
    }

Upvotes: 2

Iñaqui
Iñaqui

Reputation: 251

Both client-android and conversations-android use native libraries internally(A shared library *.so per Android architecture). As a result, by default the APK will consume the .aar with the shared libraries for all architectures.

You can look at http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits#TOC-Variant-API-Version-Code-support for more general information.

Here is a gist someone posted with an example of doing ABI splits: https://gist.github.com/ph0b/69586260bc20c58136ef

Upvotes: 6

Ashish Ranjan
Ashish Ranjan

Reputation: 5543

Just to add to @Delgado's answer, you can use Proguard to reduce your apk size significantly, if you're not using it yet.

Read more about Proguard here

Proguard rules for Twilio, as in the Twilio docs suggested by @Delgado :

-keep class com.twilio.** { *; }

Upvotes: 1

Related Questions