Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Density Split Not Working

My app includes a lot of images so currently the signed APK is > 100mb (around 115mb) even with optimized images. I want to use a density split to generate density-specific builds. I am currently including the following in my gradle file but the produced APKs are all the same size and still include all resources.

// Configures multiple APKs based on screen density.
density {

    // Configures multiple APKs based on screen density.
    enable true

    // Specifies a list of compatible screen size settings for the manifest.
    compatibleScreens 'small', 'normal', 'large', 'xlarge'
}

I noticed that someone else has experienced the same issue but no one has replied. I wanted to comment on the post but my reputation is not high enough: APK split by density still contains all resources

Does anyone have any ideas?

EDIT below are two screenshots comparing the hdpi release build and the mdpi release build. You can clearly see they are the same size:

hdpi

mdpi

compare hdpi with mdpi

like image 985
lorenzo Avatar asked Feb 06 '26 10:02

lorenzo


1 Answers

finally i solved this issue

in my case, i had to remove resConfigs on defaultConfig block on application gradle script

defaultConfig {
    resConfigs "en", "id" //remove this line
    //your other implementation
}

i don't know why, but it seems somehow resConfigs break apk split

like image 194
Rico Harisin Avatar answered Feb 08 '26 02:02

Rico Harisin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!