4

I was try to use Google's @AutoValue. But, It's not working on my Intellij.

Step.1 I was maked this class

import com.google.auto.value.AutoValue;

@AutoValue
public abstract class Example {
  public static Example create(String name, int integer) {
    return new AutoValue_Example(name, integer);
  }

  public abstract String name();
  public abstract int integer();
}

then

Step.2 typed this code into the build.gradle

dependencies {
    testCompile group: 'junit', name: 'junit', version: '4.11'
    compile group: 'com.google.auto.value', name: 'auto-value', version: '1.2'
}

Step.3 I had install AutoValue Plugin.

but Java complier give this error to me:

Error:(12, 20) java: cannot find symbol
  symbol:   class AutoValue_Animal
  location: class Animal
Tom
  • 16,842
  • 17
  • 45
  • 54
seyeon
  • 4,092
  • 2
  • 15
  • 12
  • 1
    And the target sub-directory where the autovalue classes are generated into is marked as "Source", right? – Tom Jun 23 '16 at 00:49
  • 4
    Your IDE needs to be set up to process annotations. Take a look at [this](https://github.com/google/auto/issues/106#issuecomment-44096827) and [this](http://www.jetbrains.com/help/idea/2016.1/configuring-annotation-processing.html). – shmosel Jun 23 '16 at 00:54
  • It's works!. thank you for your answer. – seyeon Aug 25 '16 at 02:46
  • In my case the code just isn't generated. Despite activating the annotation processors. :-( – Florian F Jul 16 '19 at 16:05

0 Answers0