Sunday, 13 November 2022

Android Studio: Inline compiler showing red errors only for Flavor specific Kotlin files, but compilation with gradle works fine

I know similar questions exist already. But my case seems different. I have these inline compiler error ONLY in the files that are Flavor specific; added in "...\src\myFlavor\...". And even the basic classes are not found, check the image attached in the end. When I run the app, it compiles and runs fine.

I have tried these steps already:

  • File > Invalidate Cache/Restart > Invalidate and Restart
  • Delete two files .gradle and .idea
  • Remove dependency which is showing error & Sync. Again add dependency & Sync.

I even did a fresh install of Android Studio on another laptop and pulled my code there. Nothing resolves this.

I have more than 5 flavors in my app.

I am using the following versions of gradle, kotlin and Android studio.

classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.20"

api "org.jetbrains.kotlin:kotlin-stdlib:1.7.20"

Android Studio: Dolphin | 2021.3.1 Patch 1

This issue is old, I was living with it. So now I added this question here. Please help me with it. It makes development very hard on these files.

enter image description here



from Android Studio: Inline compiler showing red errors only for Flavor specific Kotlin files, but compilation with gradle works fine

No comments:

Post a Comment