2

I am trying to make an id as primary key and set it to autoGenerate. Somehow, when I compile my code I get this error:

"autoGenerate not found"

Here is my code:

@Entity
public class Preference {

    @PrimaryKey(autoGenerate = true)
    private int id;

    public void setId(int id) {

    this.id = id;

}

Shades
  • 5,568
  • 7
  • 30
  • 48
rezastallone
  • 111
  • 1
  • 6
  • Did you work this out? What package is your `@PrimaryKey` annotation from? If it isn't `android.arch.persistence.room.PrimaryKey` then you've pulled in the annotation from some other library and that probably doesn't have the autoGenerate value property. – brindy Jan 08 '18 at 15:07

0 Answers0