I have a semi-recent android project that I'm tryi...
# multiplatform
c
I have a semi-recent android project that I'm trying to convert to multiplatform (both kotlin and compsoe multiplatform) Step one is that I added
Copy code
alias(libs.plugins.composeMultiplatform)
alias(libs.plugins.androidApplication)
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.kotlinMultiplatformPlugin.compose)
but now when I run my app it tells me my manifest is in the wrong place. it wants it in /androidMain Is there a way to do that easy wai to tell it not to look in androidMain., but just main?
e
Something like:
Copy code
android {
  sourceSets.named("main") {
      manifest.srcFile("src/main/AndroidManifest.xml")
  }
}
c
Cool. Do you know if I should maybe just set my android :app module without kotlinMultiplatform even though I plan on creating a new module called :appMulti and slowly migrate pieces of the app to it?
Only reason why i ask that is because i have different build variants for my android build like free and paid and they have their own manifests... and i feel like this might just cause an issue
e
I've been going back and forth on that in my projects. I think I've been making my Android app modules non multiplatform (i.e. I use the kotlin android plug-in)
c
okay. lemme try that.
kotlin android is still available at 2.0.0 right?
e
Yup
I think it's going to be a while before it's deprecated (if ever)
c
and then i would not be able to use jetbrains compose right?
let me give this a whirl. because i tried yest and failed
Copy code
alias(libs.plugins.composeMultiplatform)
alias(libs.plugins.androidApplication)
alias(libs.plugins.kotlinAndroid)
alias(libs.plugins.kotlinMultiplatformPlugin.compose)
Yeah. error error resolving plugin [id: 'org.jetbrains.kotlin.android', version: '2.0.0']
The request for this plugin could not be satisfied because the plugin is already on the classpath with an unknown version, so compatibility cannot be checked.
e
You could still use Jetbrains compose plugin. Just make sure you're not enabling jetpack compose also (with `buildFeatures`; I think that's "deprecated" now anyways because of the Kotlin compose compiler). That error is a leftover issue with plugins from version catalogs that will hopefully be fixed by gradle soon. Try replacing the
alias
call with
kotlin("android")
and see if that works.
c
added kotlinAndroid to my root build.gradle and everything worked!
woot.
thanks for the tip
so now i have
Copy code
alias(libs.plugins.composeMultiplatform)
alias(libs.plugins.androidApplication)
alias(libs.plugins.kotlinAndroid)
alias(libs.plugins.kotlinCompilerPlugin.compose)
Interesting enough. I do have
Copy code
buildFeatures {
  compose = true
in my app (thanks for the reminder). I wonder why everything still seemingly worked lol
e
The fix for the plugin should be in Gradle 8.8! https://github.com/gradle/gradle/pull/27200
👍 1
c
nice. just saw rc2 announced. also stumbled upon this blog. pretty recent. good overview: https://touchlab.co/compose-multiplatform-transition-guide