Yar*_*lav 27 android android-studio butterknife
我刚刚尝试为我的一个项目生成签名的apk(之前我已经这样做了),但是(也许自从更新Android Studio)我得到了
错误:错误:字符串[ResourceType]类型的预期资源
这是因为我正在使用Butterknife的@BindString,它被生成类似的东西
target.settings = res.getString(2131230792);
Run Code Online (Sandbox Code Playgroud)
如何让工作室不将此检测为错误?我试过在设置中搜索,但没有成功.
Yar*_*lav 66
对此的回答是:在build.gradle中禁用lint规则
android {
lintOptions {
disable "ResourceType"
}
}
Run Code Online (Sandbox Code Playgroud)
编辑:当从Eclipse迁移到Android Studio时,可能会发生这种情况.
这是在GitHub项目中报告的.它将在下一版ButterKnife中修复.
在那里指出了解决方法,并lint.xml在app模块上添加一个文件,其中包含以下内容,以忽略*$$ViewBinder类上的错误(ButterKnife生成的错误):
<issue id="ResourceType">
<!-- Remove this when this is fixed: https://github.com/JakeWharton/butterknife/issues/338 -->
<ignore path="**/*$$ViewBinder.java" />
</issue>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
20848 次 |
| 最近记录: |