Generate duplicate class in GreenADO in android

2019-08-03 11:49发布

问题:

why create duplicate package when generate library greenado?

this is generator

  private static final String PROJECT_DIR = System.getProperty("user.dir");

public static void main(String[] args) {
    Schema schema = new Schema(1, "com.greenado.db");
    schema.enableKeepSectionsByDefault();

    addTables(schema);

    try{
        DaoGenerator n=new DaoGenerator();
  n.generateAll(schema,PROJECT_DIR+ "\\app\\src\\main\\java");

    } catch (Exception e) {
        e.printStackTrace();
    }
}

回答1:

If you are using greenDAO 3.x Comment out the apply plugin: 'org.greenrobot.greendao' in your gradle file. Because it tries to generate the classes all over again.

So its either you use the greenDAO class generator or apply plugin: 'org.greenrobot.greendao'. You can't use both in 3.x