Reputation: 1434
I've set up some custom build tasks with gradle(Android Project), now those tasks work fine. Example of this task:
TEST {
buildConfigField "String", "KEY", "\"..\""
buildConfigField "String", "CLIENT_ID", "\"\""
buildConfigField "String", "PROTOCOL_VERSION", "\"5.0.0\""
buildConfigField "String", "BACKEND_ENVIRONMENT", "\"..\""
buildConfigField "String", "BACKEND_COUNTRY", "\"..\""
debuggable true
jniDebuggable true
signingConfig signingConfigs.debug
}
Now the problem is, that when I run the predefined task connectedAndroidTest
it complains about missing variables in the code, which are the BuildConfigFields
that aren't recognised. So my question how to work around this problem?
Thanks,
Upvotes: 1
Views: 412
Reputation: 4311
Define variables for debug
buildType
(just for debug builds)):
buildTypes {
debug {
buildConfigField "String", "KEY", "\"..\""
buildConfigField "String", "CLIENT_ID", "\"\""
buildConfigField "String", "PROTOCOL_VERSION", "\"5.0.0\""
buildConfigField "String", "BACKEND_ENVIRONMENT", "\"..\""
buildConfigField "String", "BACKEND_COUNTRY", "\"..\""
}
}
or in defaultConfig
(for all builds):
defaultConfig {
buildConfigField "String", "KEY", "\"..\""
buildConfigField "String", "CLIENT_ID", "\"\""
buildConfigField "String", "PROTOCOL_VERSION", "\"5.0.0\""
buildConfigField "String", "BACKEND_ENVIRONMENT", "\"..\""
buildConfigField "String", "BACKEND_COUNTRY", "\"..\""
}
Upvotes: 2