Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to reduce the size of an application built with Jetpack Compose?

I created an empty application on Jetpack Compose, enabled the minifyEnabled = true flag in it and compiled the release apk. Its size turned out to be 1.7 mb, which, in my opinion, is a lot for an empty application.

Can I somehow reduce the size of the application?

implementation "androidx.compose.ui:ui:$compose_version"
implementation 'androidx.compose.material:material:1.0.0-alpha10'
implementation "androidx.compose.ui:ui-tooling:$compose_version"
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.0-alpha06'
like image 421
nullproduction Avatar asked Oct 28 '25 04:10

nullproduction


1 Answers

As highlighted in https://twitter.com/vinaygaba/status/1488561816179331074, Compose apps should use:

debugImplementation "androidx.compose.ui:ui-tooling:{{ composeVersion }}"
implementation "androidx.compose.ui:ui-tooling-preview:{{ composeVersion }}"

Instead of:

implementation "androidx.compose.ui:ui-tooling:{{ composeVersion }}"

By doing so, you are going to save a few hundred kbs from your app size.

like image 172
lbarqueira Avatar answered Oct 30 '25 19:10

lbarqueira



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!