acorn
acorn copied to clipboard
Gradle dependency issue in java module
Cannot resolve reference com.nhaarman.acorn.presentation.Container class when using in pure java module.
Steps to reproduce:
- Create empty activity project using Android Studio wizard
- Create module Java Library
- Add
implementation 'com.nhaarman.acorn.ext:acorn:1.2.0'to the java module in build.gradle file - Create any interface that extends
com.nhaarman.acorn.presentation.Containerwill see the error.
Found a similar issue on StackOverflow. Maybe it is gradle issue then.
Hi @VincentJian, I was unable to reproduce this. Is this still an issue?
Yes, it is still an issue. This issue only happens in pure java module. In the last step, I mean create the interface in the java module.
I followed your steps and I had no errors. I implemented both no .ext and .ext versions. I think you have a broken gradle version or you IDE needs clear cache.
I tried again with gradle 6.5 with Android Studio 4.0 and still see this issue. I also tried invalidate and restart the IDE.
Here is the build.gradle file in my pure java module.
apply plugin: "java-library"
apply plugin: "kotlin"
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "com.nhaarman.acorn.ext:acorn:1.2.4"
}
Anyway, I convert this pure java module to android library module and this issue is gone.