Cannot access class phantom error


I have a project with 3 modules:

±- app module
±- aar module
±- other module

When I try to use a method from my aar that uses a class of ‘other module’ it shows an error Cannot access class ‘other.class’. Check your module classpath for missing or conflicting dependencies
What is driving me crazy is that ic compiles and the app works; And if I do the same in a Java file, the IDE don’t show me the error.

I don’t know how to find any issue related with this, it could be a bug in the Kotlin plugin, the IDE inspector, the way that I compile the aar…

Kotlin KMainActivity.kt



What is the visibility of process?


Process method is public, public boolean process(Mat image)


Well your error message tells you, what your problem is. If you go into your module settings there should be a tab called dependencies. Make sure that your aar module sets the other module as a dependency.


Yes, I understand what it says but the thing is that it shows an error but it compiles and it works and the same in Java (it compiles and works) does not shows the error. It is why I am not sure if is an issue in my code or in the Kotlin plugin.


Woops sry. I missed the part where you said that it compiles. Maybe try creating a new project and copying the code. I had a similar issue using gradle where intellij would not find my dependencies but the compiler would


I just created a new project and the error still there, it shows the error in the Kotlin file but not in java files.
Also I tried to compile the @arr in different ways but nothing seems to make the error disappear.
Probably it’s a bug in the Kotlin plugin :disappointed_relieved:



This seems to happen to me when I have modules that have intervening jar dependencies.

So if I have 3 modules written in Kotlin:

A <- B <- C

And I dont have the source of module B, only a jar for it, then I see this phantom issue in module C

As Chavi says, the compiler seems to work fine (I can build and run unit tests from the IDE), it is the kotlin syntax highlighter that seems to mess up

IntelliJ IDEA 2018.1.2 (Community Edition)
Build #IC-181.4668.68, built on April 24, 2018
JRE: 1.8.0_152-release-1136-b29 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.12.6

Kotlin Plugin: 1.2.31-release-IJ2018.1-1