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

查看:29
本文介绍了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);

我怎样才能让工作室不将此检测为错误?我试过在设置中搜索,但没有成功.

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 模块上的 code>lint.xml 文件,其中包含以下内容以忽略 *$$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天全站免登陆