As you can see the res folder is of 2.2 MB only still the APK size is 17 MB. The lib folder is of 11 MB so I think something is wrong with this. Anybody can suggest me what's wrong with this so that my APK size can be reduced.
Asked
Active
Viewed 5,363 times
-4
-
you can enable **minify** your code using gradle and also shrink your resources. https://developer.android.com/studio/build/shrink-code.html – Uday Naidu May 08 '17 at 08:23
-
2whats your `minifyEnabled` status ? runProguard – IntelliJ Amiya May 08 '17 at 08:23
-
1http://stackoverflow.com/questions/25101534/reducing-android-app-apk-size – IntelliJ Amiya May 08 '17 at 08:24
-
yes minify and shrinkResources both are true – Krishna Meena May 08 '17 at 08:25
-
I am using proguard too – Krishna Meena May 08 '17 at 08:25
-
`... the res folder is of 2.2 MB only ...` But the `lib` folder is over 24 MB. Just to say. – Phantômaxx May 08 '17 at 09:39
-
I got the issue, actually there was 1 library which was increasing APK size to 10 MB – Krishna Meena May 08 '17 at 13:33
-
Well, you see: my previous comment said it all. – Phantômaxx May 08 '17 at 15:25
-
Thanks all for the help, I know it was a silly question but still I learned a lot from this. Thanks again.. – Krishna Meena May 08 '17 at 17:38
2 Answers
2
1st
android {
// Other settings
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
2nd
Reduce Resource Count and Size.
Remove Unused Resources.
3rd
Compress the .jpg files as much as possible, You can use TinyPng
Hope this solves your problem

Abdul Kawee
- 2,687
- 1
- 14
- 26
-
and if you still need more try to use `proguard-android-optimize.txt` https://developer.android.com/studio/build/shrink-code.html – Ralph Bergmann May 08 '17 at 08:27
2
you are using some native code inside your application(your own app code or maybe the libraries), hence the libs folder and the .so(shared object) files are getting generated.you can't escape from this. lol. anyway you can rectify this problem by splitting your apk for different CPU-architectures. open up your app-level build.gradle and paste this code. you'll get different apks for different CPU-architectures.
splits {
abi {
enable true // enable ABI split feature to create one APK per ABI
universalApk true //generate an additional APK that targets all the ABIs
}
}
// map for the version code
project.ext.versionCodes = ['armeabi':1, 'armeabi-v7a':2, 'arm64-v8a':3, 'mips':5, 'mips64':6, 'x86':8, 'x86_64':9]
android.applicationVariants.all { variant ->
// assign different version code for each output
variant.outputs.each { output ->
output.versionCodeOverride =
project.ext.versionCodes.get(output.getFilter(com.android.build.OutputFile.ABI), 0) * 10000000 + android.defaultConfig.versionCode
}
}
later on, you can upload these apks on play store with particular one architecture only. for more information, refer this great blog and this blog

Jay
- 2,852
- 1
- 15
- 28