I'm experiencing this error using Bumblebee (AKA, 2021.1.1) Canary 6, 7, and 8, using compose version 1.0.0, 1.0.1, and 1.1.0-alpha01. I've just raised a bug on the Studio issue tracker:
https://issuetracker.google.com/issues/196248459
To quote myself:
It seems clear this is a "left hand doesn't know what right hand is doing" thing, because PreviewActivity
is not in that package, but rather androidx.compose.ui.tooling
– it hasn't been in android.compose.ui.tooling.preview
since compose 1.0.0-beta09.
UPDATE
I was able to get previews working again by clearing off all the preview run configurations. Here were my steps:
- Click on the "run configurations" selector and select Edit Configurations...
- Expand the Compose Preview grouping
- Select all the preview configurations (you can select the first and shift-select the last)
- Click the
-
button to remove all the collections
- Click
Ok
- Run Invalidate Caches... in the file menu
- After AS restarts and your cache repopulates, run a preview. It should work now.
Apparently AS was caching "junk" in the temporary run configurations it was creating every time I launched a preview. The "junk" was valid for earlier versions of AS, but broke later versions. Clearing out this cache got me working again.