一些常见错误

来源:互联网 发布:java项目相对路径 编辑:程序博客网 时间:2024/06/05 14:53

1.R.layout.xxxx提示错误

头部Import载入的R错误。


2.syntax error

语法错误。


3.The connection to adb is down, and a severe error has occured

第一种:cmd跳到sdk tools文件路径下输入adb kill-server,然后再输入adb start-server。

第二种:右键项目——>Android Tools ——>Fix Project Properties,再run。

第三种:在DDMS中右键选择Reset adb。


4.按钮点击监听反应提示错误

在类的头部没有声明用了按钮监听器的接口。


5.07-04 05:40:26.132: W/dalvikvm(1450): threadid=1: thread exiting with uncaught exception (group=0xb4afbb90)
   07-04 05:40:26.192: E/AndroidRuntime(1450): FATAL EXCEPTION: main
   07-04 05:40:26.192: E/AndroidRuntime(1450): Process: com.example.fragmentbestpractice, PID: 1450
   07-04 05:40:26.192: E/AndroidRuntime(1450): android.content.ActivityNotFoundException: Unable to find explicit activity class{com.example.fragmentbestpractice/com.example.fragmentbestpractice.NewsContentActivity}; have you declared this activity in your AndroidManifest.xml?

活动没有注册


6.R.id.xxx提示错误

头部import调用的R是这个项目包下的即import com.xxx.activity.R,而不是import android.R


7.LogCat没有显示

进入DDMS视图,在Devices窗口点击一下你当前的设备,打印信息就会出来了


8.Invalid layout of java.lang.String at value

run as configurations中检查是否有这个安卓应用,没有的话要new一个名字相同的程序

0 0