2

I have generated a new Kotlin Multiplatform Mobile (KMM) project with Android Studio. I am able to do the following things successfully:

  • Sync project with Gradle files
  • Build project for Android and iOS
  • Run Android and iOS apps successfully
  • Command + hover over certain declarations to see method signatures/documentation

The issue is that syntax highlighting is not working. I see IDE hints, as seen in the image below, but still, there are red marks under everything.

enter image description here

I have tried the following

  • Sync project with Gradle files (in case anything was out of sync)
  • Build > Rebuild Project
  • File > Invalidate Caches / Restart ...
  • Reinstall Android Studio (several times)
  • Deleted various folders, like ~/.android, cached folders, et cetera

but none of these have worked.

I have the following versions:

  • Android Studio: 4.2 Canary 16
  • Kotlin plugin: 1.4.20-release-Studio4.2-1
  • KMM plugin: 0.2.0-release-65-Studio4.2

This is all boilerplate code generated by the KMM plugin for Android Studio, so I'll hold off with posting any code unless anyone wants me to.

What could be the issue?

eirikvaa
  • 1,070
  • 1
  • 13
  • 24
  • I know it sounds a bit silly, but I reproduced the problem, then my AS got corrupted(like [that](https://stackoverflow.com/questions/61682609/android-studio-missing-essential-plugin-org-jetbrains-android)), I reinstalled it from scratch and now everything works fine. Please try reinstalling your Canary, or opening the project with AS 4.1.1. – Artyom Degtyarev Nov 25 '20 at 15:01
  • Yeah, after posting this I tried re-installing several times with luck. But I'll post an answer, because I fixed it this morning by going to File > Manage IDE Settings > Restore Default Settings. – eirikvaa Nov 26 '20 at 10:10
  • 1
    That's great you finally fixed it. Ordinary re-installation worked badly for me too, only removing whole my `~/Library/Application\ Support/Google/AndroidStudioPreview4.2/` helped. Your solution is even better. I'll try to find an appropriate ticket on Kotlin's YouTrack for this, or open a new one referring to this question. – Artyom Degtyarev Nov 26 '20 at 10:27

1 Answers1

2

I solved the issue by going to File > Manage IDE Settings and clicking Restore Default Settings. Then it restarted, took me through the Android Studio setup wizard, and when launching the project syntax highlighting worked as expected.

eirikvaa
  • 1,070
  • 1
  • 13
  • 24