Android Studio 禁用 "Expected resource of type string"

标签 android android-studio butterknife

我刚刚尝试为我的一个项目生成签名的 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/

相关文章:

android - 应用卡在 camera.release() 上

java - Android Studio 线程调试

java - 重新打开选项卡时,Android Studio 布局引用失效

android - ButterKnife 不与 Jack 合作?

android - 如何使用 Butterknife 解决 NullPointerException void com.google.android.gms.ads.AdView.loadAd(com.google.android.gms.ads.AdRequest)

android - 跨平台随机再现性

java - android中的后台线程

android - 无法在 Android Market 中找到应用程序

Android Jack 编译器 : how to enable incremental mode?

java - ButterKnife 5.1.1 Proguard 错误