gpt4 book ai didi

安卓 :connectedAndroidTest can't find symbol . 。 -> BuildConfigField 渐变

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

我已经使用 gradle(Android Project) 设置了一些自定义构建任务,现在这些任务工作正常。此任务的示例:

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
}

现在的问题是,当我运行预定义任务 connectedAndroidTest 时,它会提示代码中缺少变量,即无法识别的 BuildConfigFields。那么我的问题是如何解决这个问题?

谢谢,

最佳答案

debug buildType 定义变量(仅用于调试构建):

buildTypes {
debug {
buildConfigField "String", "KEY", "\"..\""
buildConfigField "String", "CLIENT_ID", "\"\""
buildConfigField "String", "PROTOCOL_VERSION", "\"5.0.0\""
buildConfigField "String", "BACKEND_ENVIRONMENT", "\"..\""
buildConfigField "String", "BACKEND_COUNTRY", "\"..\""
}
}

或在 defaultConfig 中(对于所有构建):

defaultConfig {
buildConfigField "String", "KEY", "\"..\""
buildConfigField "String", "CLIENT_ID", "\"\""
buildConfigField "String", "PROTOCOL_VERSION", "\"5.0.0\""
buildConfigField "String", "BACKEND_ENVIRONMENT", "\"..\""
buildConfigField "String", "BACKEND_COUNTRY", "\"..\""
}

关于安卓 :connectedAndroidTest can't find symbol . 。 -> BuildConfigField 渐变,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28579020/

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