AndroidStudio 開發報錯彙總

錯誤1:xml文件名稱大寫了

Error:Execution failed for task ':myevent:mergeDebugResources'.
> D:\MyStudioProject\mydemo\myevent\src\main\res\layout\Right_fragment.xml: Error: 'R' is not a valid file-based resource name character:File-based resource names must contain only lowercase a-z, 0-9, or underscore


錯誤2 :Fragment使用沒有配備ID

10-17 04:42:45.087 1094-1094/? E/AndroidRuntime:  Caused by: java.lang.IllegalArgumentException: Binary XML file line #9:Must specify unique android:id, android:tag, or have a parentwith an id for com.example.pengfei.myevent.Fragment.LetFragment


錯誤3 :findViewById時,找不到對應的id,一定是xml文件錯誤

我在這裏犯的錯誤是,多加一個空格

< RelativeLayout
經驗:xml 首尾標籤要一一對應,否則xml解析不成功


錯誤4:自定義屬性xmlns命名空間報錯

AS建議我們的自定義屬性命名空間爲:

xmlns:android_custom="http://schemas.android.com/apk/res-auto"

錯誤5:AS導入eclipse工程.9圖報錯

把.9的後綴去掉(有其他好的方的話,求大家推薦)

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章