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.

error: cannot find symbol @Generated( ^

See original GitHub issue

Building via Android Studio works fine, but if I call

./gradlew build

I get

error: cannot find symbol
@Generated(
 ^

all over the place. I’m using the latest version of dagger. My android project is set to Java 8 source. Calling java --version in my terminal tells me I have java 9 (which I’m not sure how, but I that’s besides the point). Any ideas what I should be doing? I’ve seen a bunch of mixed answers on stackoverflow, but adding a dependency feels weird. My system being on java 9 doesn’t make sense to me because I though Android Studio bundles it’s own version of the JDK.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:23
  • Comments:32

github_iconTop GitHub Comments

25reactions
Cliabhachcommented, May 23, 2019

I managed to work around this on a JDK 11 install by adding the following to the bottom of my affected modules’ build.gradle files. I imagine it would work in a subprojects.afterEvaluate block in the top-level build.gradle too.

    if (project.hasProperty('kapt')) {
        // Reference for 'kapt' DSL: https://kotlinlang.org/docs/reference/kapt.html#java-compiler-options
        kapt {
            // we expect this closure to run over a org.jetbrains.kotlin.gradle.plugin.KaptExtension
            javacOptions {
                option("-source", "8")
                option("-target", "8")
            }
        }
    }
11reactions
Malachiaszcommented, Mar 5, 2020

In Kotlin 1.3.70 it’s fixed

Read more comments on GitHub >

github_iconTop Results From Across the Web

IntelliJ error: cannot find symbol @javax.annotation.Generated
I have cloned a github project into IntelliJ that uses gradle. I import and first thing it says is that gradle is not...
Read more >
BUILD FAILURE - cannot find symbol (symbol: class ... - GitHub
When executing "mvn appengine:deploy" I'm getting the following error: [ERROR] COMPILATION ERROR :
Read more >
error: cannot find symbol @javax.annotation.Generated
What steps will reproduce the issue? Running test case on project cloned directly from Github; Simple project using this class. What is the...
Read more >
How to Resolve The Cannot Find Symbol Error in Java - Rollbar
When the Java compiler encounters a use of an identifier which it cannot find in the symbol table, it raises the cannot find...
Read more >
The "Cannot find symbol" Compilation Error - Baeldung
The “cannot find symbol” error comes up mainly when we try to use a variable that's not defined or declared in our program....
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