https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
m

matsem

02/21/2023, 1:29 PM
Hey everyone, I’m not sure if this really belongs here, or to #android-studio so I’ll be glad for any further pointers, but I have the following issue that happens only for Kotlin classes defined in shared KMM gradle module. Here goes: I have a pretty standard KMM project setup with :androidApp and :shared module. 1. I create a Kotlin class in :shared module 2. I create a Java class in :androidApp module that provides a getter to the class from 1) 3. I create a Kotlin class in :androidApp module that calls the getter via Java class from 2) The IDE shows an error in Kotlin class from 3rd point:
Cannot access class … Check your module classpath for missing or conflicting dependencies
, but project compiles just fine. Has anyone encountered such error / Is there any way to make the autocompletion work for such case?
We have a project that previously used Java and over the years was migrated to Kotlin with KMM. There are still some places where such cases happen.
I was able to reproduce the issue on a sample project with minimal setup: https://github.com/matejsemancik/java-kmm-interop-issue
This is the error, for visualisation
13 Views