Upgrading to Jetpack Compose Alpha 12 causes errors on setContent

As per this issue, this issue is related to the new androidx.activity:activity-compose:1.3.0-alpha01 artifact.

From that issue:

Activity 1.3.0-alpha02 has been released and fixes this issue.

Apps using Compose alpha12 and specifically artifacts like androidx.compose.ui:ui-test-junit4:1.0.0-alpha12 that internally use setContent should add the activity-compose:1.3.0-alpha02 dependency to their dependencies block to ensure that the 1.3.0-alpha01 artifact is not used

So to fix your app, you should:

  1. Remove the freeCompilerArgs += "-Xallow-unstable-dependencies" line from the build.gradle file (as it is no longer needed)

  2. Add a specific dependency on Activity Compose 1.3.0-alpha02:

implementation 'androidx.activity:activity-compose:1.3.0-alpha02'

By adding that dependency, any direct usages of setContent as well as internal usages by androidx.compose.ui:ui-tooling:1.0.0-alpha12 or androidx.compose.ui:ui-test-junit4:1.0.0-alpha12 will use the fixed Activity Compose 1.3.0-alpha02 release.