32839

I have a 'mobile' module that depends on a 'core' module, and I keep getting the same inconsistent error:
mobile/build.gradle:
debug {
buildConfigField "String", "URL_SEARCH", "\"https://mobile.debug\""
}
release {
buildConfigField "String", "URL_SEARCH", "\"https://mobile.release\""
}
core/build.gradle:
debug {
buildConfigField "String", "URL_SEARCH", "\"https://core.debug\""
}
release {
buildConfigField "String", "URL_SEARCH", "\"https://core.release\""
}
Whenever I set my variants to be mobile debug + core debug, I still get the same output inside my core.MyApplication.java file: 'https://core.release':
<img src="https://i.stack.imgur.com/iPdl1.png" alt="mobile+core in debug variant">
Answer1:
Whenever your modules imports another dependency-module, the dependency-module uses it's 'release' variant.
See: BuildConfig.DEBUG always false when building library projects with gradle
The solution for this is to use your com.main.module.BuildConfig.DEBUG variables, and not your com.dependency-module.BuildConfig.DEBUG...cause this debug will always be false.