【发布时间】:2020-08-06 19:53:52
【问题描述】:
Android Studio 现在警告这一重大变化即将到来。
Resource IDs will be non-final in Android Gradle Plugin version 5.0, avoid using them in switch case statements
唯一的其他选项是 if/else 吗?
【问题讨论】:
-
也许他们希望你使用 Kotlin 的“何时”声明?不知道问题是否仍然存在...kotlinlang.org/docs/reference/control-flow.html
-
那么什么是java解决方案? switch 只支持原始类型而不是视图等。
-
我在一个使用 ButterKnife 的旧项目中也遇到了这个问题。错误出现在 BindView 行上。 @BindView(R.id.button_text) protected TextView buttonText;
-
在使用 kotlin 的时候仍然存在;在字节码中是相同的语句。
-
不,我们必须使用 if/else 阶梯语句,stackoverflow.com/questions/64335374/…
标签: android