Are preview functions also compiled in with the code? If not couldn't the compose compiler plugin just delete functions annotated with Preview? I cant think of any reason why they would need to be in the resulting build
r
romainguy
08/21/2024, 4:38 AM
@Preview is not a concept known by the compiler plugin. In fact none of the "Compose UI" layers are known by the compiler, it's just a usage of Compose the runtime.
romainguy
08/21/2024, 4:38 AM
Also previews need to be compiled to be executed and rendered, and a preview could very well be used by the app at runtime (there's nothing special about a preview composable).
romainguy
08/21/2024, 4:39 AM
R8 will however get rid of previews not invoked by the app
☝️ 3
☝🏻 1
romainguy
08/21/2024, 4:39 AM
(and it's highly recommended you use R8 if you are targeting Android)