CrazyGaj
CrazyGaj

Reputation: 9

Useless resources in APK file

I've got problem with very simple application. APK size is now 3 MB, but it contains a lot of useless for me files (I think that source of this files is Support Library). In my application I don't use any images, but all drawable directories contains a lot of icons, buttons, etc. Is it possible to delete this images by any rule in gradle or other method? I use Android Studio.

Already I added to build.gradle information about languages to include in APK. I had in Hello World 80 languages before it.

Screen of files:

enter image description here

Upvotes: 0

Views: 351

Answers (1)

Prokash Sarkar
Prokash Sarkar

Reputation: 11873

The Gradle build system for Android supports "resource shrinking": the automatic removal of resources that are unused, at build time, in the packaged app. In addition to removing resources in your project that are not actually needed at runtime, this also removes resources from libraries you are depending on if they are not actually needed by your application.

To enable this add the line shrinkResources true in your gradle file.

    android {
        ...

        buildTypes {
            release {
                shrinkResources true
            }
   }
}

Check the official documentation here,

http://tools.android.com/tech-docs/new-build-system/resource-shrinking

Upvotes: 1

Related Questions