如何更改为图书馆的依赖模块构建变量? [英] How do I change the build variant for a library dependency module?
问题描述
我有一个移动模块所依赖的核心模块上,我不断收到同样的错误不一致:
I have a 'mobile' module that depends on a 'core' module, and I keep getting the same inconsistent error:
移动/的build.gradle:
mobile/build.gradle:
debug {
buildConfigField "String", "URL_SEARCH", "\"https://mobile.debug\""
}
release {
buildConfigField "String", "URL_SEARCH", "\"https://mobile.release\""
}
核心/的build.gradle:
core/build.gradle:
debug {
buildConfigField "String", "URL_SEARCH", "\"https://core.debug\""
}
release {
buildConfigField "String", "URL_SEARCH", "\"https://core.release\""
}
每当我把我的变种,以可移动的调试+内核调试,我仍然得到同样的输出我core.MyApplication.java文件中:的 HTTPS://core.release ':
推荐答案
每当你的模块导入另一个依赖模块,依赖模块使用它的'释放'的变种。
Whenever your modules imports another dependency-module, the dependency-module uses it's 'release' variant.
请参阅:<一href=\"http://stackoverflow.com/questions/20176284/buildconfig-debug-always-false-when-building-library-projects-with-gradle\">BuildConfig.DEBUG建库项目用时的gradle
对此的解决方案是使用你的com.main.module.BuildConfig.DEBUG变量,而不是你的com.dependency-module.BuildConfig.DEBUG ......造成这种调试将永远是假的。
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.
这篇关于如何更改为图书馆的依赖模块构建变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!