美文网首页
No resource identifier found for

No resource identifier found for

作者: 初见soulmate | 来源:发表于2019-08-02 10:46 被阅读0次

今天在给项目增加bugly热更新功能时工程报错了,主要内容如下:

No resource identifier found for attribute 'xxx' in package xxx
In <declare-styleable> unable to find attribute xxx

报错是因为自定义view找不到相关配置属性.
找了一些资料,尝试了一些方法,但是都不起作用,仔细检查了配置也没发现问题.

最终的解决方式如下:
在<declare-styleable>的相关属性中指定类型
报错之前的代码如下:

<declare-styleable name="TabBar">
...
    <attr name="text"/>
...
</declare-styleable>

解决之后的代码如下:

<declare-styleable name="TabBar">
...
    <attr name="text" format="string"/>
...
</declare-styleable>

原因分析:
可能是由于使用了热更新配置之后,编译时对相关配置和代码的检查要求增强了,自定义view的部分相关属性需要明确指定类型.

相关文章

网友评论

      本文标题:No resource identifier found for

      本文链接:https://www.haomeiwen.com/subject/debkdctx.html