android备忘录

1. cannot override the final method from Activity

自定义函数和android系统函数重名,重命名即可.

2.报错:Failed to find an AVD compatible with target 'Google APIs'

创建AVD时target 选择"Google APIs" //target是在项目的project.properties中定义

3.Android Device Chooser 的target提示"unkown target"

重置手机的"设置-开发者选项",并打开"USB"调试

4. android logcat显示乱码

打开eclipse的windows>preferences>android>logCat,修改"Display Font"改为"宋体".

5. android项目中添加第三方jar包

1. 在android项目右键创建一个libs文件夹(也可取其他名称),将要引用的jar放在这个目录里
2. 项目名右键,依次选择Build Path -> Configure Build Path,选择library选项卡。点击右边的add jars,选择libs目录下的jar包.

你调试还会出错("could not find class"或其他)的话可以尝试右键点击libs目录,选择build path –> configure as source folder ,基本上到这一步就可以正常使用第三方jar包,继续你的android开发之旅了

6. operator is not allowed for source level below 1.7

所需的JDK版本太低,project右键 > properties > Java compiler > enable "project specific settings" Set "Compiler compliance level" to 1.6 re Build your project

7. Unable to execute dex: Multiple dex files define

jar被重复引用,可以查看你的build path,尤其是Android Dependencies一定有重复引入的.jar包,解决的方法是删除Android Dependencies即可。

8.  java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()

在AsyncTask.doInBackground中使用Toast.makeText引发的,原因是"主线程已经建立了Looper,而新线程没有",将Toast操作挪到AsyncTask.onPostExecute中即可

9.MIUI上开发APP更改图标后图标不变

miui会缓存图标.先卸载旧APP,重启再安装

10.setError文字不显示

显示的内容和背景的颜色相同导致(style.xml:<style name="AppBaseTheme" parent="android:Theme.Light">和manifest.activity:android:theme="@android:style/Theme.Light.NoTitleBar)


CharSequence html1 = Html.fromHtml("<font color=#808183>请输入验证码</font>");
mEditText.setError(html1);



或改activity的android:theme="@android:style/Theme.NoTitleBar"


要点:

1. 默认的情况下,android 程序启动时,会有一个黑屏的时期

只要在入口activity 加上android:theme="@android :style/Theme.Translucent" 就可以解决启动黑屏的问题

开发环境:

1. android sdk报错

A.Unexpected exception ‘Cannot run program “.../sdk/platform-tools/adb”:error=2 No such file or directory'

系统是ubuntu 14.04 64位的,而ADB是32位的,要运行这个程序必须依赖32位的相关库.

sudo apt-get install  libc6-i386 lib32gcc1 lib32stdc++6

B.../sdk/build-tools/21.1.1/aapt: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directory

sudo apt-get install  lib32z1

转载于:https://my.oschina.net/meilihao/blog/345842

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值