To get Compose preview to work I need this depende...
# compose
a
To get Compose preview to work I need this dependency:
implementation "androidx.compose.ui:ui-tooling:$compose_version"
But then that means that library will increase the size of my production build. Is there a way around this?
j
R8 should clean everything
a
Cheers. I guess so. I should start using it!
s
should have already, you said you already published the app 😧
a
https://android-review.googlesource.com/c/platform/frameworks/support/+/1739498
However, users concerned in packaging
PreviewActivity in their release builds and/or worried about the APK size
impact caused by ui-tooling now have the option to add ui-tooling-preview as
an implementation API and ui-tooling as debugImplementation. PreviewActivity
won't then be part of the release APK, and its size shouldn't increase too
much, since ui-tooling-preview should be much smaller than ui-tooling.
1
ui-tooling contains PreviewActivity which is defined in AndroidManifest.xml so it won't be stripped by R8.
1
a
Thanks Albert. It's open source, Sergei. I have no desire to obfuscate it. But if it helps performance I'll give it a go. Performance seems fine currently, however.