gpt4 book ai didi

android - 即使在 Release模式下构建,DEBUG 始终为真

转载 作者:行者123 更新时间:2023-12-02 12:45:14 25 4
gpt4 key购买 nike

BuildConfig 的 DEBUG总是正确的,无论我是否在发布版本中构建。我知道 BuildConfig文件实际上是在构建期间和执行期间生成的 DEBUG也永远如此。

public final class BuildConfig {
public static final boolean DEBUG = Boolean.parseBoolean("true");
public static final String APPLICATION_ID = "myId";
public static final String BUILD_TYPE = "release";
public static final String FLAVOR = "prd";
public static final int VERSION_CODE = 1;
public static final String VERSION_NAME = "1.0";
// Fields from product flavor: prd
public static final String BASE_URL = "http://10.0.2.2:3000/";
}
android {
compileSdkVersion 28
flavorDimensions "default"
defaultConfig {
applicationId "myId"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
dataBinding {
enabled = true
}

signingConfigs {
debug {
storeFile file('../debug.keystore')
storePassword debugStorePassword
keyAlias debugKeyAlias
keyPassword debugKeyPassword
}

// FIXME
// https://developer.android.com/studio/publish/app-signing
release {
storeFile file('../debug.keystore')
storePassword debugStorePassword
keyAlias debugKeyAlias
keyPassword debugKeyPassword
}
}

buildTypes {
release {
testCoverageEnabled true
minifyEnabled false
signingConfig signingConfigs.release
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}

debug {
signingConfig signingConfigs.debug
applicationIdSuffix ".debug"
}
}

productFlavors {
prd {
buildConfigField('String', 'BASE_URL', BASE_URL_LOCAL)
}

dev {
buildConfigField('String', 'BASE_URL', BASE_URL_LOCAL)
}
}

kotlinOptions {
jvmTarget = "1.8"
}
}

最佳答案

我找到了问题所在。
testCoverageEnabled true自动设置 DEBUG为 true,因此您必须将其删除或将其放置在 debug buildType 中。

关于android - 即使在 Release模式下构建,DEBUG 始终为真,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61739357/

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