Android编程心得-常见问题解决办法

更新时间:2024-03-04 05:08:01 阅读量: 综合文库 文档下载

说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

1.进行模拟器调试时出现 Failed to install Remote_Monitoring.apk on device 'emulator-5554': timeout

解决办法:在Eclipse-->Window-->Preferences-->Android-->DDMS-->ADB connection time out (ms) 中将默认的5000ms改为10000ms或更长

2.当前工程出现红色感叹号

解决办法:可能是引用jar包的地址不正确,4.0以下引用的是lib文件夹内的地址,4.0就变成libs了

3.Failed to install Remote_Monitoring.apk on device 'emulator-5554': EOF

解决办法:关闭模拟器,重启模拟器

4.android.os.NetworkOnMainThreadException

解决办法:当一个应用程序试图在它的主线程执行网络操作的时候就会抛出这个异常,将网

络请求写在线程中或写到AsyncTask中

5.The content of the adapter has changed but ListView did not receive a notification make sure the content of your adapter is not modified from a background thread . but only from the UI thread

解决办法:

1.改变适配器Adapter内容时不要在后台线程中,必须在UI线程中处理,这点可以通过Handler传出来解决。

2.亲身经历,当你改变了适配器绑定的泛型List的值时,比如泛型对象是list,你调用了list.clear(),一定要在主线程通知,也就是调用Adapter的notifyDataSetChanged()

6.Error receiving broadcast Intent

{ act=android.bluetooth.adapter.action.DISC

解决办法:在广播接收器的OnReceive函数中,将除了String action = intent.getAction() 的操作放到if语句中,保证广播接收器的不同ACTION不会处理相同的取函数代码

7.java.lang.RuntimeException: Unable to start activity

ComponentInfo{com.bluecomrfmeter/com.bluecomrfmeter.BlueComConnectActivity}:

java.lang.SecurityException: Need BLUETOOTH permission: Neither user 10184 nor current process has android.permission.BLUETOOTH.

解决办法:在AndroidManifest.xml 中加上

本文来源:https://www.bwwdw.com/article/nuta.html

Top