When is the removal of drawable resources (when packaging an APK — when building an APK or installing an APK on a specific device?) And why aren’t mipmap resources deleted?

For example, it can be used to make it possible.

PS And what does "Android split system" mean?

    1 answer 1

    When does removal of drawable resources occur (when packaging an APK — when building an APK or installing an APK on a specific device?)

    The removal of resources occurs at the stage of the project assembly (after all, the purpose of this is to reduce the size of the APK). You can exclude resources using the exclude operator, for example:

     exclude "ldpi", "xxhdpi", "xxxhdpi" 

    and why mipmap-resources are not deleted?

    This is the whole feature of mipmap resources. Further I will quote my answer :

    Why do mipmap need mipmap ?

    To correctly display images on displays with different DPI, qualifiers (for example, mdpi, hdpi) were introduced into Android. In order for images to appear correctly on all devices, you need to place these images with all available qualifiers (in the appropriate resolutions).

    Placing images in different resolutions entails an increase in the size of the application.

    Suppose you know that Bob has such a DPI value, and Alice has some other. To reduce the size of the application, you can separately build the application for Bob and separately for Alice, including images only at the required resolution. When building a project, you can exclude unnecessary images (using the appropriate Gradle configuration), for example:

     exclude "ldpi", "xxhdpi", "xxxhdpi" 

    It seems to be all right: unnecessary images are excluded and the size of the application is reduced. However, not everything is so smooth. Some images can be displayed in resolutions that do not correspond to the one in which you left these images in the project. An example is the application icon, in some launchers it can be increased. Since the application icon you have in a single resolution (like all other images), it will be enlarged and so-called will occur. pixelation - the image will be blurry (with a large upscale, small squares will be noticeable).

    This is where mipmap comes to the rescue - images placed there will not be excluded. That is, if you specify in Gradle:

     exclude "ldpi", "xxhdpi", "xxxhdpi" 

    then the corresponding images from the drawable will be excluded, but not from the mipmap .


    Android split system - the conditional name of the set of structures that is used to share resources for the APK.

    • That is, the removal of drawable-resources occurs only when explicitly specifying exclude when building? - Ksenia
    • @Ksenia; I can’t say exactly, but judging by this , the installation doesn’t remove resources. Although I could be wrong. - post_zeew