Unresolved Reference in Android Studio 3.0.1 when using gradle sourceSets


#1

I have a complex Android project with several modules.

I converted an existing Java class into Kotlin. What I’ve discovered is that there’s an unresolved reference in Android Studio 3.0.1 in the converted Kotlin class in Module 2 when it tries to reference a Java class in Module1. Basically, there’s a bunch of red in the code editor. However, the Kotlin class builds and runs successfully. I was just wondering if there was a way to get rid of the errors/red that weren’t present when the class was written in Java.

build.gradle (Module2)

	sourceSets {
    		main {
    			java {
    				srcDir '../Module1/src/androidTestSupport/java'
    			}
    			res {
    				srcDir '../Module1/src/androidTestSupport/res'
    			}
    		}
    	}