一财搁、前言:
公司項目中之前用的是Eclipse 項目轉(zhuǎn)化為 Android Studio 項目時報錯“<item> inner element must either be a resource reference or empty”
有的人更新AS之后,之前有一個老的項目出現(xiàn)如上所示的問題躬络,導(dǎo)致build失敗尖奔。
翻譯之后: <item>內(nèi)部元素必須是資源引用或為空。
二、解決:
1. 錯誤格式:
<item name="animator" type="id">false</item>
<item name="date_picker_day" type="id">false</item>
在開發(fā)文檔中提茁,https://developer.android.com/guide/topics/resources/more-resources#Id
也有提到說上面那種方式已經(jīng)不能這么寫了淹禾,新的方法如下:
2. 正確格式:
<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會自動處理這些問題毁习。
參考作者:有沒有一種幸運和你相遇
鏈接:http://www.reibang.com/p/592308a335ff