Does Android Studio remove resources that the app does not use or leave them?
even if they are not used?
The answer is not to delete them, by default the resources remain in the generated .apk.
to remove resources easily go to the option menu:
Refactor > Remove Unused resources
With this option the resources that are not used in your project will be removed easily and you will not have to be looking at the project.
The shrinkResources
and minifyEnabled
properties do not actually remove resources not used by the application.
shrinkResources
merge resources with similar names that in
Sometimes we can leave in different resource directories.
minifyEnabled
for code reduction and optimization.
this can be configured within the file: build.gradle
android {
...
buildTypes {
release {
shrinkResources true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}