I found two possible ways to generate a release APK
Defining Product Flavours & Signing Config as below in the module build.gradle file and then clicking the Run button (betaRelease Config)
android {
signingConfigs {
my_alias {
keyAlias 'my_alias'
keyPassword '*******'
storeFile file('*******')
storePassword '******'
}
}
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
minSdkVersion 16
targetSdkVersion 22
versionCode 9
versionName "0.2"
resConfigs "en","hi","te"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.my_alias
}
debug {
minifyEnabled false
}
}
productFlavors {
alpha {
applicationId = "***************"
resValue 'string', 'app_name', '**********'
resValue 'string', 'instabug_app_id','*******************'
manifestPlaceholders = [onesignal_app_id : "*******************",
onesignal_google_project_number: "************"]
}
beta {
applicationId = "***************"
resValue 'string', 'app_name', '**********'
resValue 'string', 'instabug_app_id','*******************'
manifestPlaceholders = [onesignal_app_id : "*******************",
onesignal_google_project_number: "************"]
}
}
aaptOptions {
additionalParameters "--no-version-vectors"
}
}
Using the Generate Signed APK Option from the Build menu in Android Studio
There is a huge difference here with the first APK with 14.5MB and the Second one giving 22.5MB. Using the APK Analyzer I could see that the second one is duplicating the drawables in the res folder as shown below. The smaller release APK (14.5MB one) is working well on all kind of devices.
Why do I need the bigger one? Can I upload the normal release APK into play store ?
Is there any configuration to build avoiding the duplicate drawables?
Raw File Size represents the unzipped size of the entity on disk while Download Size represents the estimated compressed size of the entity as it would be delivered by Google Play. The % of Total Download Size indicates the percentage of the APK's total download size the entity represents.
Application signing ensures that one application cannot access any other application except through well-defined IPC. When an application (APK file) is installed onto an Android device, the Package Manager verifies that the APK has been properly signed with the certificate included in that APK.
I will try to answer this question, based on my observations.
Why do I need the bigger one? Can I upload the normal release APK into play store ?
When you release apk by clicking "Run" button you are targeting specific device (emulator or usb device) and you are genereting resources only for this target. That's why you have smaller .apk file.
If you want deploy and target to all density of devices you should use "Generate Signed APK" option to provide resources (ex. images) for all devices.
The smaller release APK (14.5MB one) is working well on all kind of devices.
I think because images are scaled to fit on the screen. But you are loosing quality on images in this way.
Is there any configuration to build avoiding the duplicate drawables?
in Providing Resources instruction is written that:
The layout direction of your application. ldrtl means "layout-direction-right-to-left". ldltr means "layout-direction-left-to-right" and is the default implicit value.
All of this means that you don't have duplicated drawables but now they are in proper directories.
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