android(eclipse)新手常见问题总结(一)

1:jdk无法更新
  进入工具里面手动获取镜像资源 并且改为强制

2:报错:This version of the rendering library is more recent than your version of AD

  在布局预览中重新选择适合你的sdk的版本

3:当添加文本信息有黄色感叹号错误时或者报错(I18N] Hardcoded string "this is textview", should use @string resource)

  可以在string 添加<string name="message1">Button 2</string>  然后在在布局里面引用android:text="@string/message1"

4:报错:No Launcher activity found!  The launch will only sync the application package on the device!
  活动注册中intent-filter 出了问题或者是其中的sdk版本不对

5:报错:Premature end of file.   试一下先保存再运行

6:报错:The method setOnClickListener(View.OnClickListener) in the type View is not applicable for the arguments (new OnclickListener(){})

  检查拼写是否错误

7:添加progressdialog控件时如果setcancelabel设为了false则一定要在代码中dismiss(—)来关闭对话框要不然一直存在无法取消无法退出程序

8:报错:[Accessibility] Missing contentDescription attribute on image  

  在一些没有文本显示的控件里,如imageView和imageButton等,ADT会提示你定义一个android:contentDescription属性,用来描述这个控件的作用

9:报错:Cannot make a static reference to the non-static field ViewHolder.leftMsg
  第一种,可以把变量改成静态的。第二种,先实例化对象,然后使用对象名.变量名来调用即可(我就是因为直接用了类名来调用一直出错。。。zzz)问题

10:报错:OnClickListener cannot be resolved to a type
  将“new OnClickListener”改为“new View.OnClickListener”,因为android版本升级后,将“OnClickListener”接口移到了View类中
  或者是导入import android.view.View.OnClickListener;或者是拼写错误

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

  我遇到的问题是端口占用,可以采用netstat -ano查看是否有其他程序占用启动android adb需要的通信端口,我当时是因为安装了两个手机助手,卸载了一个就好了。

posted @ 2016-03-18 23:29  风雨缠舟  阅读(841)  评论(1编辑  收藏  举报