1、cannot resolve symbol R
resolved: a)包名com.halcyon.Calculator在修改为小写,即com.halcyon.calculator时,拼写错误
b)如果确定没有错误,执行File-->Invalidate caches/Restart ,一般可以解决。
2、 java.lang.NullPointerException at onCreateView()
android.view.InflateException
cannot resolve method findById(int)
resolved: a)在Fragment中使用,源码为(Button)findViewById(R.id.btn),报错,后改为(Button)view.findViewById(R.id.btn)后,无编译错误
3、libpng err: Read Error
resolved: a)如果图片是非png图片是通过直接修改后缀强行变为png图片的,改用转换工具把非png转成png
b)检查图片的分辨率,是否跟文件夹(drawable、mipmap)对应的分辨率一致
4、使用substring 出现 IndexOutOfBoundException 异常
resolved: 首先,在API中的描述如下:public String substring(int start,int end) Returns a new string containing the characters from start to end - 1。 Throws indexOutOfBoundsException if start<0,strat >end or end > length()。 所以,应检查程序运行中是否会出现以上起始标签start为小于零,或者大于终止标签,同时,终止标签不能大于String的长度。
5、Your content must have a ListView whose id attribute is 'android.R.id.list'
resolved:可能是因为我们要实现对ListView中setOnItemClick的事件监听而去继承了LiseActivity,但是却没有ListView的标签,只要在布局文件中添加定制Layout的代码,
即将ListView的id设置为“@android:id/list”或android:id="@id/android:list",这时可以用getListView来获取ListView的对象了。
6、java.lang.NullPointerException
resolved:在使用一个声明的变量前,请确保它已经被初始化,且值不是null。