RRR_1173 RRR_1173 - 10 months ago 54
Android Question

How to reduce Android Apk size

I am developing application which contains below dependency

Module level

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:design:23.3.0'
compile 'com.google.android.gms:play-services:9.0.0' **// for GCM**
compile 'com.android.support:cardview-v7:23.3.0'
compile 'com.squareup.picasso:picasso:2.5.2' **//Rounding and displaying image from URL**
compile 'com.google.code.gson:gson:2.6.2'
compile 'com.github.lecho:hellocharts-library:1.5.8@aar' **// For bar graph**
compile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') {
transitive = true;
compile 'com.google.firebase:firebase-core:9.0.0' **// Analytics**


Project level

dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
classpath 'com.google.gms:google-services:3.0.0'
classpath 'io.realm:realm-gradle-plugin:1.0.1' // Database
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files


/Assets /150kb using font aweasome file.

/java - 644 KB

/res - 740 KB (used high resolution image 1920*1280 size 220kb compress with tinypng)

Already applied ProGuard.
delete unused file and codes.


Still my app size is 7.03MB

How can i reduce app size? i don't know why this is 7.03MB

Is there any calculation which give size that used by dependency in apk?

Like google play service occupied around 200kb in apk.

Answer Source

In versions of Google Play services prior to 6.5, you had to compile the entire package of APIs into your app. In some cases, doing so made it more difficult to keep the number of methods in your app (including framework APIs, library methods, and your own code) under the 65,536 limit.

From version 6.5, you can instead selectively compile Google Play service APIs into your app. For example, to include only the Google Fit and Android Wear APIs, replace the following line in your build.gradle file:


compile 'com.google.android.gms:play-services:9.6.1' //or the version you are using

with specific api's you need:

// and other if you need

List of dependencies for specific GMS apis can be found here.