question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for Kotlin 1.5.20

See original GitHub issue

With Kotlin 1.5.20-RC I get this error.

Works with Kotlin 1.5.10.

Dagger version 2.37

/Users/username/projects/myproject/appname/build/tmp/kapt3/stubs/devAppnameDebug/de/company/appname/ApplicationMain.java:47: error: [Hilt]
public final class ApplicationMain extends company.appname.ApplicationBase {
             ^
  Expected @HiltAndroidApp to have a value. Did you forget to apply the Gradle Plugin? (dagger.hilt.android.plugin)
  See https://dagger.dev/hilt/gradle-setup.html
  [Hilt] Processing did not complete. See error above for details.
/Users/username/projects/myproject/appname/build/tmp/kapt3/stubs/devAppnameDebug/de/company/appname/ui/SecondFragment.java:43: error: [Hilt]
public final class SecondFragment extends company.appname.ui.base.BaseFragment {
             ^
  Expected @AndroidEntryPoint to have a value. Did you forget to apply the Gradle Plugin? (dagger.hilt.android.plugin)
  See https://dagger.dev/hilt/gradle-setup.html
  [Hilt] Processing did not complete. See error above for details.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:55
  • Comments:9

github_iconTop GitHub Comments

43reactions
bcorsocommented, Jun 13, 2021

This sounds like a bug in the kotlin/kapt plugin rather than Hilt. In particular, javaCompilerOptions.annotationProcessorOptions are just getting ignored in general, as mentioned in https://github.com/google/dagger/issues/2684#issuecomment-860175674. This ends up causing Hilt to fail because the Hilt Gradle plugin sets these options in HiltGradlePlugin.kt.

FWIW, it looks like the processing options set through kapt.javacOptions do still work, so as a workaround you can set the options manually:

kapt {
    javacOptions {
        // These options are normally set automatically via the Hilt Gradle plugin, but we
        // set them manually to workaround a bug in the Kotlin 1.5.20
        option("-Adagger.fastInit=ENABLED")
        option("-Adagger.hilt.android.internal.disableAndroidSuperclassValidation=true")
    }
}
26reactions
bcorsocommented, Jun 23, 2021

I’ve filed a bug with kotlin here: https://youtrack.jetbrains.com/issue/KT-47416

Read more comments on GitHub >

github_iconTop Results From Across the Web

What's new in Kotlin 1.5.20
Version 1.5.20 introduces support for the JSpecify project, which includes the standard unified set of Java nullness annotations.
Read more >
Kotlin 1.5.20 Released! - The JetBrains Blog
Kotlin /JVM improvements, including string concatenation via invokedynamic and experimental support for calling Java's Lombok-generated methods ...
Read more >
JetBrains - Kotlin 1.5.20 is out! Support for... - Facebook
Kotlin 1.5.20 is out! Support for Java's Lombok annotations in Kotlin/Java sources String concatenation via invokedynamic ⚙️ Stdlib and...
Read more >
How has Kotlin/Native 1.5.20 improved compiler bug fixes?
Kotlin continues to stay up to date and updates and fixes the issues in Kotlin 1.5.0. Kotlin 1.5.20 has been released, and makes...
Read more >
The Android Gradle plugin supports only Kotlin Gradle plugin ...
The Android Gradle plugin supports only Kotlin Gradle plugin version 1.5.20 and higher when flutter run · Ask Question. Asked 1 month ago....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found