https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
a

AndreiBogdan

03/07/2023, 2:59 PM
Hello! Here's a neat one .... So ... I've played around with the project here https://github.com/touchlab/KMMBridgeSampleKotlin and then I've created a KMM module in my Android project in order to enable KMM support for it. I have both created the shared module by hand and also imported the module from the project in the link above. In BOTH cases, I can't see the code in the "commonMain" folder, unless I move it to "main" ... what am I missing ?! I'm going crazy here 😞 I'm guessing my existing Android project lacks some sort of configuration, but ... I have no idea what. (tried clean-rebuild/ invalidate cache/ etc)
t

touchlab_justin

03/07/2023, 3:11 PM
I noticed you aren't in #touchlab-tools. Just wanted to make you aware that you can cross-post this there
j

Jeff Lockhart

03/07/2023, 5:15 PM
Did you add the shared module as a dependency in your Android app?
Copy code
dependencies {
    implementation(project(":shared"))
}
a

AndreiBogdan

03/09/2023, 6:13 AM
@Jeff Lockhart yes, i did. I guess If I wouldn't have done that, it wouldn't even see the "main" folder in the module, so ... seems the module is "linked" properly. I think. Is there something one needs to add to the build.gradle of the Android Project itself, besides the implementation(":shared") ? I also added the
include ':shared'
in my settings.gradle file @touchlab_justin than you Justin !
I haven't done anything to the build.gradle of the existing Android Project. It's still in Groovy as well. Is there something required to be added there as well by any chance ?!
j

Jeff Lockhart

03/09/2023, 10:09 AM
When you say "can't see the code", do you mean you can't see the code from the Android app to call the shared module, or that you can't see the files in the project view in the IDE? If it's the latter, are you using the Android view by chance (drop down at the top of the project view)? If so, I'd recommend using the Project view for multiplatform modules, as the Android view isn't entirely compatible yet.
a

AndreiBogdan

03/13/2023, 11:10 AM
Hi. It was the former. The problem was that i had to update
com.android.tools.build:gradle
in the Android project first and I also updated other classpaths and dependencies. Now it sees the code in the
commonMain
folder
4 Views