您的位置:首页 > 编程语言 > Java开发

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

2016-03-18 23:29 651 查看
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;或者是拼写错误
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: