How to set buildConfigField for module from outside for android?

782 views Asked by At

I am developing in Android, and I have a submodule in my project.

I have set buildConfigField like the following in build.gradle of Module

buildTypes {
    release {
        minifyEnabled false
        buildConfigField "String", "TestId", '"48"'
    }
    dev {
        buildConfigField "String", "TestId", '"88"'
    }
}

And I use TestId in module.

But I want to change the TestId from outside, like build.gradle of app.

How to set the buildConfigField of module from build.gradle of app for Android ?

Thanks in advance.

1

There are 1 answers

0
littlebear333 On

Your question is a little confusing for me. I don't really get your point. But I want to point out. The buildConfigField will generate corresponding field in BuildConfig. And these fields are decorated by final keyword. So they can't be changed.