1

I am using android jetpack compose and wrote some code that is being displayed in the preview section of android studio, but when I run the project and install the app in mobile then full content is not being displayed, only some little content is being displayed that is of previous code, but when I changed the code, then changes is being displayed in preview, but not in mobile. I searched for it but did not get any solution that why changes are not being displayed on mobile. Any help would be appreciated great!

Aniruddh Parihar
  • 3,072
  • 3
  • 21
  • 39
  • Welcome to StackOverflow! Please refer to the guide on [how to ask a good question](https://stackoverflow.com/help/how-to-ask) and when needed, how to provide a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) so people can try to help you with a problem. You're often expected to do your own homework and research before asking a question. – Martin Marconcini Jul 30 '21 at 13:54

1 Answers1

1

Okay, I'm not sure exactly what you're dealing with, but I had a similar issue where the app doensn't show anything on both the device and emulator and this is what worked for me. Running it from the preview solves it for me. Once you have a connected device, hitting the little run image(with a green play icon) on the top right corner of the preview pane will launch on the device or emulator. If you can't see this icon, scroll the preview pane all the way to the right.

screenshot of image

However, to run your app using the normal run button on android studio, you need to make sure that your setContent{ } block inside onCreate is calling your Composable functions you declared earlier. This was the missing link for me as well.

Oleohi
  • 86
  • 1
  • 5
  • This looks *very* similar to [another of your answers](https://stackoverflow.com/a/69160435/10871073). Please refrain from posting such 'duplicate' answers. – Adrian Mole Sep 13 '21 at 12:39