5

I've written a sample using Jetpack Compose then whenever i try to Install it on an AVD, gradle builds the Project Successfully but the Built App doesn't launch. Everything About the Tools and Codes is ok, even Preview shows UI fine, if i Build APK and Install it myself manually then the app will install and correctly. in other words Android Studio doesn't install the App on AVD Automatically.

Android Studio = 4.2 Canary 10 | compose = 1.0.0-alpha02 | kotlin = 1.4.0 | gradle plugin = 4.2.0-alpha10 | gradle = 6.6.1

  • You could try to either restart the AVD or create a fresh (new) one. If that doesn't help, could you share the full log maybe? – Daan Sep 18 '20 at 06:42
  • @Daan I've tried to create a fresh AVD, but it doesn't work, as i told before gradle builds the Project successfully but android studio doesn't install the Built APK on emulator with no log and no error – mohammad jahangiry Sep 19 '20 at 10:53

2 Answers2

2

Make sure that android:exported flag for your launch activity in AndroidManifest is set to true

konnovdev
  • 823
  • 8
  • 16
0

I had the same issue, but what worked for me was running it from the preview. 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 preview button to run app on device or emulator

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