admin管理员组文章数量:1564175
最近升级AS 更新到4.1 Canary5+ ,发现库工程BuildConfig.java 没有VERSION_CODE和VERSION_NAME.
找了好多资料,最后在https://issuetracker.google/issues/154275579#comment3发现问题原因,并且标为不予修复。
Version Code mean nothing for Libraries. It's actually potentially confusing as one might expect that the BuildConfig.VERSION_NAME of a library is set to the version name of the app but this was never the case. For these reasons, it's better to not include it in library modules.
大致意思是:"Version Code 在库模块中不代表任何意义。它还容易让人混淆以为把库模块的versoin_name是App的version_name. 基于这些原因,它最好不应该被包含再库模块中"
如果我还想在库模块中继续使用VERSION_CODE、VERSION_NAME,那有没有不解决方案呢?
当然还有的。
比如可以再build.gradle中再把VERSION_CODE,VERSION_NAME定义回来。
debug {
buildConfigField "String", "VERSION_NAME", "\"1.2.0\""
buildConfigField "int", "VERSION_CODE", "2"
}
release {
buildConfigField "String", "VERSION_NAME", "\"1.2.0\""
buildConfigField "int", "VERSION_CODE", "2"
}
本文标签: 找不到符号CanaryStudioandroid
版权声明:本文标题:Android Studio 4.1 Canary 5+ Library Module BuildConfig 找不到符号 VERSION_CODE VERSION_NAME 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://www.elefans.com/dongtai/1726604943a1077449.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论