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
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.
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.
确保AndroidManifest 中启动活动的android:exported
标志设置为true
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.