#587·greenDAO

GreenDAO generator not taking product flavor into account

Author: WebMajstr-Created Feb 17, 2017Updated Sep 18, 2023
LabelsBug

When I build application with flavor, objects for all classes marked with @Entity tag get build, not just the ones in current flavor or in main folder.

This is causing build issues in cases where greenDAO dependency exists just for a specific flavor.

For example, if I have classes with @Entity in pro flavor, they get generated even if i build lite version, and the app.gradle looks like following

java
apply plugin: 'com.android.application'
apply plugin: 'org.greenrobot.greendao'    

android {
   ...
    productFlavors {
        lite {
            ...    
        }
        pro {
            ...
        }
    }
}    

greendao {
   schemaVersion 1
}    

dependencies {
    proCompile 'org.greenrobot:greendao:3.2.0'
}