我刚刚尝试为我的一个项目生成签名的 apk(我之前已经这样做过),但是(可能是在更新 Android Studio 之后)我得到了
Error:Error: Expected resource of type string [ResourceType]
这是因为我使用的是 Butterknife 的 @BindString,它会生成类似的东西
target.settings = res.getString(2131230792);
如何让工作室不将此检测为错误?我尝试在设置中搜索,但没有成功。
最佳答案
答案是:在 build.gradle 中禁用 lint 规则
android {
lintOptions {
disable "ResourceType"
}
}
编辑: 从 Eclipse 迁移到 Android Studio 时尤其可能发生这种情况。
关于Android Studio 禁用 "Expected resource of type string",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35009832/