Android编程心得-常见问题解决办法(不断更新中..)

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<T>的值时,比如泛型对象是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 中加上    <uses-permission android:name="android.permission.BLUETOOTH" />
    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> 权限





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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值