AndroidStudio 开发报错汇总

来源:互联网 发布:淘宝宝贝套餐怎么设置 编辑:程序博客网 时间:2024/04/28 11:22

错误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的后缀去掉(有其他好的方的话,求大家推荐)

0 0