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 usesetContent
should add theactivity-compose:1.3.0-alpha02
dependency to theirdependencies
block to ensure that the1.3.0-alpha01
artifact is not used
So to fix your app, you should:
Remove the
freeCompilerArgs += "-Xallow-unstable-dependencies"
line from thebuild.gradle
file (as it is no longer needed)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.