gradle-experimental:0.1.0 buildConfigField

本小妞迷上赌 提交于 2020-01-02 05:41:08

问题


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:


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.



来源:https://stackoverflow.com/questions/31683438/gradle-experimental0-1-0-buildconfigfield

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!