3

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?

3
  • I know it sounds a bit silly, but I reproduced the problem, then my AS got corrupted(like that), I reinstalled it from scratch and now everything works fine. Please try reinstalling your Canary, or opening the project with AS 4.1.1. Commented Nov 25, 2020 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. Commented Nov 26, 2020 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. Commented Nov 26, 2020 at 10:27

1 Answer 1

2

Update: Use the suggestion below as a last resort. Instead, try following the built-in troubleshooting guide in Android Studio.


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.

Sign up to request clarification or add additional context in comments.

5 Comments

IMPORTANT: Remember to export your settings. You're gonna lose everything even your plugins when you do this. And it didn't work for me.
same, this is not a good solution, wacked all my plugins. didn't fix issue.
Agreed, this is not a good solution and was proposed when I was still an Android Studio rookie.
this works for me I'm using Android Studio Ladybug Feature Drop | 2024.2.2
update: (As I can't edit above comment) The above solution removes all the installed plugins and solves the issue, so the actual problem was the SqlDelight plugin in my case here: stackoverflow.com/questions/29827067/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.