admin管理员组

文章数量:1530340

最近升级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