1

I am working on KMP project and I have a problem with accessing to my shared module source files from app module.

Android studio complains about everything, what are related to the commonMain source files (shared module), and says Unresolved reference: exampleVariableFromSharedModule and intellisence is also lost.

When I run the project, everything works fine and there is no compilation issues at all.

I'm trying to fix that issue almost hole week.

Tried:

  1. cleaning the project,
  2. invalidate & restart
  3. used different versions of Kotlin.
  4. open the project in two different versions of android studio (4.1.1 & 4.2 preview) with no luck.
  5. removed the shared module from settings.gradle & build.gradle synced, then restore.
  6. File -> Manage IDE Settings -> Restore Default Settings
  7. Disable / enable kotlin plugin
  8. removed .idea and all build folders

Last thing that I tried:

Uninstalled all Android Studios and its related folders, downloaded it again but still getting the same problem.

Jemo Mgebrishvili
  • 5,187
  • 7
  • 38
  • 63
  • Just another idea: try deleting your `.idea` folder (make a backup before, you'll lose your run configurations among other things), and reimporting the project. – Nicolas Dec 24 '20 at 21:34
  • Tried it and result is same, thanks anyway – Jemo Mgebrishvili Dec 24 '20 at 21:46
  • This happened to me a few times, it goes away eventually. Sometimes it's a cache issue, sometimes it's an error in your build script, sometimes it's downright a bug. You can always try the ultimate solution: reinstalling AS, although I don't recommend it, because it takes a long time. Otherwise there's a multitude of duplicate questions that might have other answers: [1](https://stackoverflow.com/q/31712046/5288316), [2](https://stackoverflow.com/q/49545037/5288316), [3](https://stackoverflow.com/q/5905896/5288316), etc... – Nicolas Dec 24 '20 at 22:18
  • tried all of them and still got same problem, now I'll try to uninstall all Android studios – Jemo Mgebrishvili Dec 25 '20 at 10:34
  • There are a few [bug reports](https://youtrack.jetbrains.com/issue/KT-31052) that can be related, might be you are hitting one of these issues – esentsov Dec 25 '20 at 16:34
  • Hello, @JemoMgebrishvili! Can you please give me an update about this situation? Is the problem still here, or you managed to work around it somehow? – Artyom Degtyarev Feb 09 '21 at 07:21
  • yes in my case I had a one dependncy inside common scope implementation "com.squareup.sqldelight:android-paging-extensions:1.2.1" and removing that fixed the problem – Jemo Mgebrishvili Feb 09 '21 at 07:56

0 Answers0