Anthony
Anthony

Reputation: 7828

gradle-experimental:0.1.0 buildConfigField

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'

Upvotes: 4

Views: 1032

Answers (1)

Gabriele Mariotti
Gabriele Mariotti

Reputation: 363825

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.

Upvotes: 5

Related Questions