lol, already the first issue running the first ste...
# compose
i
lol, already the first issue running the first step in Google's tutorial:
Copy code
class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContent {
            Text("Hello world!")
        }
    }
}
java.lang.NoSuchMethodError: No static method setContent$default(Landroidx/activity/ComponentActivity;Landroidx/compose/Recomposer;Lkotlin/jvm/functions/Function0;ILjava/lang/Object;)Landroidx/compose/Composition; in class Landroidx/ui/core/WrapperKt; or its super classes (declaration of 'androidx.ui.core.WrapperKt' appears in /data/app/com.match.android-863fKnuh3LTaDvTF4A7agg==/base.apk)
a
I have battled with that error since the release of Compose. You either have the wrong compiler version, or instead of using the kotlin-android plugin, you are using the kotlin-multiplatform plugin. For now stick to the current compiler version as instructed by compose and do not use the kotlin-multiplatfrom gradle plugin. It doesn't support compose just yet
i
yeah, it seems that I was missing some configuration steps
it works now 👍
t
You should also inherit from this: class MainActivity: ComponentActivity()
i
thanks! (seems that the tutorial is outdated? https://developer.android.com/jetpack/compose/tutorial)
t
Maybe it is not so important. But my app is under 2 mb (including Kotlin runtime and Compose runtime) and when you are using AppCompatActivity you have to depend on this appcompat libraries which will increase the App size.
👍 1