AndroidStudio禁用“字符串类型的预期资源"; [英] AndroidStudio disable "Expected resource of type string"

查看:84
本文介绍了AndroidStudio禁用“字符串类型的预期资源";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚尝试为我的一个项目生成带签名的apk(我之前已经做过),但是(也许是由于更新Android Studio之后)我得到了

I've just tried to generate signed apk for one of my projects (I already did this before), but (maybe since updating Android Studio) I'm getting

错误:错误:类型为字符串[ResourceType]的预期资源

Error:Error: Expected resource of type string [ResourceType]

这是因为我正在使用Butterknife的@BindString,它会生成类似这样的东西

This is because I'm using Butterknife's @BindString, that is generated into something like that

target.settings = res.getString(2131230792);

如何使Studio无法将其检测为错误?我尝试搜索设置,但没有成功.

How can I make studio not detect this as error? I've tried searching in settings, but without success.

推荐答案

在GitHub上的项目. 它将在下一版的ButterKnife中修复.

This is reported on the GitHub project. It will be fixed in the next version of ButterKnife.

的地方指出了解决方法,并添加了<app模块上的c0>文件,其内容如下,以忽略*$$ViewBinder类(ButterKnife生成的类)上的错误:

The workaround is indicated there, and is to add a lint.xml file on the app module with the following content to ignore that errors on *$$ViewBinder classes (the ones that ButterKnife generates):

<issue id="ResourceType">
    <!-- Remove this when this is fixed: https://github.com/JakeWharton/butterknife/issues/338 -->
    <ignore path="**/*$$ViewBinder.java" />
</issue>

这篇关于AndroidStudio禁用“字符串类型的预期资源";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆