Search code examples
android-studiokmm

Kotlin Multipplatform - can't see Greeting.kt in Android Studio folder tree


I am just starting to learn KMM (I'm an Android java guy right now) and going through the default Greeting version of Hello World that is automatically put into a new application. My environment seems to be working as I was able to run the default app on both Android and iOS emulators.

However I can't see the file Greeting.kt in the Project tree. I can certainly search for it and open it from Find, but when I drill down the tree shared/commonMain/kotlin/com.myapp... it only shows Platform.

I have a screen cap that shows the path of the open Greeting.kt at the top, but not visible in the tree:

(screen cap)

Unfortunately I can't post an image (not enough reputation), but when I open the file Greeting.kt by doing a Find In Project, it shows the path at the top of the screen (My Application > shared > src > commonMain > kotlin > com > example > myapplication > Greeting), but when I manually drill down the Project tree on the left side of Android Studio Greeting.kt does not show up.

I can also find the file in the Mac Finder. My guess a preference in Android Studio is incorrect?

Any ideas on what might be wrong?

Thanks in advance


Solution

  • Turns out it was an official bug. Solution is to upgrade to Beta version of Android Studio (Chipmunk)

    I submitted a bug report to Google and they looked into it:

    The root cause is that before [Android Studio]Chipmunk the source set setup was incorrect, so even though it says commonMain in your screenshot (from #2), if you open the Platform.kt under that source set, you'll see that it is in fact shared/src/androidMain/kotlin/com/example/myapplication/Platform.kt. [Android Studio] Chipmunk fixes this issue.