nhaarman / acorn

Mastering Android navigation :chipmunk:
https://nhaarman.github.io/acorn
Apache License 2.0
181 stars 7 forks source link

Gradle dependency issue in java module #158

Open VincentJian opened 4 years ago

VincentJian commented 4 years ago

Cannot resolve reference com.nhaarman.acorn.presentation.Container class when using in pure java module.

Steps to reproduce:

  1. Create empty activity project using Android Studio wizard
  2. Create module Java Library
  3. Add implementation 'com.nhaarman.acorn.ext:acorn:1.2.0' to the java module in build.gradle file
  4. Create any interface that extends com.nhaarman.acorn.presentation.Container will see the error.

Found a similar issue on StackOverflow. Maybe it is gradle issue then.

nhaarman commented 4 years ago

Hi @VincentJian, I was unable to reproduce this. Is this still an issue?

VincentJian commented 4 years ago

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.

programadorthi commented 4 years ago

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.

VincentJian commented 4 years ago

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.