I have recently created a library Jar file that I imported in my Android project. I am able to call functions and use classes that are present in this Jar file, but Android Studio keeps telling me that it cannot "resolve symbol" of the class I am using. Please see the screenshot below:
Click here for full-size image
The code builds and executes successfully. The function
Sync Project with Gradle Files
Invalidate Caches / Restart...
Cannot resolve symbol 'xxxSDK'
I found the issue - my
SDK.jar was not generated correctly. It included
.java files instead of
.class files. This explains why the IDE was not able to find the SDK class. The package structure was still correct in the Jar, which is why the package name itself is not a red color. The code worked correctly, because the compiler knew to compile the
To solve the issue, I modified my
build.gradle of my SDK project to include
.class files, instead of
.java files, when creating the Jar. Including this new Jar instead of the old Jar fixed the IDE issue.