gpt4 book ai didi

android - 即使我选择调试,buildType 也总是会发布

转载 作者:行者123 更新时间:2023-11-29 15:44:15 26 4
gpt4 key购买 nike

我想通过以下方式区分发布和调试 buildTypes:

 buildTypes {
release {
minifyEnabled false
signingConfig signingConfigs.release
buildConfigField "boolean", "REPORT_CRASHES", "true"
resValue "boolean", "REPORT_CRASHES", "false"


}
debug {
buildConfigField "boolean", "REPORT_CRASHES", "false"
resValue "string", "REPORT_CRASHES", "false"
}
}

我想像这样以编程方式访问它们:

if("true".equals(getResources().getString(R.string.REPORT_CRASHES))|| BuildConfig.REPORT_CRASHES)
LoggingUtils.setupAirbrake(this);

我什至尝试这样做:

          if(BuildConfig.BUILD_TYPE.equals("debug")){}

问题:

即使我单击调试按钮并选择调试作为构建变体,BUILD_TYPE 始终会提示“发布”。是否有任何配置覆盖调试按钮和调试构建变体以使其成为“发布”

有什么想法吗?

最佳答案

根据 Gradle 文档:

Library Publication: By default a library only publishes its release variant. This variant will be used by all projects referencing the library, no matter which variant they build themselves. This is a temporary limitation due to Gradle limitations that we are working towards removing. You can control which variant gets published:

android {
defaultPublishConfig "debug"
}

所以如果你有一个本地库并且你想调试它,你应该添加这个参数。

关于android - 即使我选择调试,buildType 也总是会发布,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35301260/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com