gradle-experimental:0.1.0 buildConfigField

2019-05-07 02:31发布

Anyone know how to define buildConfigField in the experimental gradle plugin?

android.productFlavors {
    create("demo") {
        applicationId = 'com.anthonymandra.rawdroid'
        buildConfigField "String", FIELD_META, PROVIDER_META
    }

gives:

Error:Attempt to read a write only view of model of type 'java.lang.Object' given to rule 'model.android.productFlavors'

1条回答
smile是对你的礼貌
2楼-- · 2019-05-07 03:06

With the buildType you can use a syntax like this:

android.buildTypes {
    debug {
        buildConfigFields.with {
            create() {
                type = "String"
                name = "FIELD_META"
                value = "PROVIDER_META"
            }
        }
    }
}

I am not sure if you can use the same syntax with flavors.

查看更多
登录 后发表回答