有一個老的項目出現如上所示的問題,導致build失敗。查看錯誤問題之後發現代碼是如下格式的:
<item name="animator" type="id">false</item>
<item name="date_picker_day" type="id">false</item>
然後網上找到了一些資料:
在開發文檔中,https://developer.android.com/guide/topics/resources/more-resources#Id
也有提到說上面那種方式已經不能這麼寫了,新的方法如下:
<item name="animator" type="id"/>
<item name="date_picker_day" type="id"/>
如果引入的是第三方包怎麼修改呢?
1、在你的項目res\values文件夾下新建ids.xml
文件
2、將之前編譯出錯的item重新寫一遍,改成下面的
<?xml version="1.0" encoding="utf-8"?>
<resources>
<item name="animator" type="id"/>
<item name="date_picker_day" type="id"/>
...
</resources>
重新build之後AS會自動處理這些問題。
原作者:有沒有一種幸運和你相遇
轉自鏈接:https://www.jianshu.com/p/592308a335ff