最近做android开发遇到的一些错误和解决办法
自己总结的在android中常会出现的不好解决的问题和方法
(其中第三个方法经过了四天的折磨。。。。。哎)
1.报错:
BUILD FAILED
D:\workspace\ganji\build.xml:144: The following error occurred while executing this line:
D:\workspace\ganji\build.xml:271: Unable to delete file D:\workspace\ganji\tmp\proguard\tmp.jar
解决:
已经开了一个模拟器了,无法重新编译,必须关闭一个。用于ant
2.报错:
The connection to adb is down, and a severe error has occured.
这个问题谁能解决啊
解决:
cmd跳到sdk tools文件路径下
adb kill-server
然后再adb start-server
3.报错:
The connection to adb is down, and a severe error has occured.
[2010-03-11 09:36:56 - HelloOPone] You must restart adb and Eclipse.
[2010-03-11 09:36:56 - HelloOPone] Please ensure that adb is correctly located at 'D:\OPhoneSDK_1.5
\platform-tools\adb.exe' and can be executed.
解决:
方法1.cmd中adb kill-server,然后adb -startserver
方法2.方法1不管用,那么在任务管理器中杀死adb.exe,然后重启Eclipse。
方法3.方法1和2都不管用,那么查看最后一句报错中:platform-tools中是否有adb.exe(我的错误就是在相关路径下面没有platform-tools文件夹
,所以我选择新建一个文件夹,并且把tools中的文件全部复制到platform-tools中)
4.前面的方法试了还是不行的话,建议重新装一个系统,最好换个系统。有些大牛也说过:MS存在一些小问题[size=large][/size]
XX 15:35 2012-8-30
"......The method onAccuracyChanged(Sensor, int) of type Fundamentals must override a superclass......"
"......The method onClick(View) of type new View.OnClickListener(){} must override a superclass...... "
“......The method onSensorChanged(SensorEvent) of type Fundamentals must override a superclass......”
OO 15:35 2012-8-30
在
Eclipse中依次打开:项目属性-->javaCompiler,找到其中的complier compliance level
将1.5改为1.6。 就是说Java
1.5的编译器默认对父类的方法进行覆盖,采用@Override进行说明;但1.6已经扩展到对接口的方法,所以如果还是以Java
1.5的编译器来编译的话,会出现错误。 java的编译器是1.6版本的,选择编译级别为1.6即可。
XX 15:56 2012-8-30 Field requires API level 5 (current min is 1): ......
OO 15:56 2012-8-30 Right click on the project folder > Android tools > Clear Link Markers
XX 10:32 2012-9-19 Eclips 无法格式化代码,
OO 10:33 2012-9-19 去掉搜狗输入法的快捷键
XX 10:23 2012-9-21 ADB server didn't ACK 虚拟机无法启动
OO 10:23 2012-9-21 都是豌豆荚惹的祸,卸载掉豌豆荚就OK
XX 14:57 2012-9-25 Cannot refer to a non-final variable editText inside an inner class defined in a different method
OO 14:57 2012-9-25 内部类什么的,没看明白。但是把变量在之前定义成private就OK
XX 14:45 2012-9-26 创建Handler时报错(The constructor Handler(new Callback(){}) is undefined)
OO 14:46 2012-9-26 在头文件中加入import android.os.Handler.Callback;