遇到的android_bug总结

1、android.content.pm.PackageManager$NameNotFoundException

     这个是因为安装的应用程序,不完整,apk有问题导致。

     下载的时候出异常的话写一个接口。有一个回调。

     出错了,怎么处理。
     从arraylist删除

D/PackageManager( 1991): generateServicesMap(android.accounts.AccountAuthenticat
or): 5 services unchanged
W/System.err(19190): android.content.pm.PackageManager$NameNotFoundException: co
m.trustgo.security
W/System.err(19190):    at android.app.ApplicationPackageManager.getPackageInfo(
ApplicationPackageManager.java:78)
W/System.err(19190):    at com.trustgo.addon.dolphin.scan.z.b(Unknown Source)
W/System.err(19190):    at com.trustgo.addon.dolphin.scan.BootReceiver.onReceive
(Unknown Source)
W/System.err(19190):    at android.app.ActivityThread.handleReceiver(ActivityThr
ead.java:2119)
W/System.err(19190):    at android.app.ActivityThread.access$1500(ActivityThread
.java:123)
W/System.err(19190):    at android.app.ActivityThread$H.handleMessage(ActivityTh
read.java:1197)
W/System.err(19190):    at android.os.Handler.dispatchMessage(Handler.java:99)
W/System.err(19190):    at android.os.Looper.loop(Looper.java:137)
W/System.err(19190):    at android.app.ActivityThread.main(ActivityThread.java:4
424)
W/System.err(19190):    at java.lang.reflect.Method.invokeNative(Native Method)
W/System.err(19190):    at java.lang.reflect.Method.invoke(Method.java:511)
W/System.err(19190):    at com.android.internal.os.ZygoteInit$MethodAndArgsCalle
r.run(ZygoteInit.java:787)
W/System.err(19190):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.ja
va:554)
W/System.err(19190):    at dalvik.system.NativeStart.main(Native Method)
W/System.err(19190): android.content.pm.PackageManager$NameNotFoundException: co
m.trustgo.security.beta
W/System.err(19190):    at android.app.ApplicationPackageManager.getPackageInfo(
ApplicationPackageManager.java:78)
W/System.err(19190):    at com.trustgo.addon.dolphin.scan.z.b(Unknown Source)
W/System.err(19190):    at com.trustgo.addon.dolphin.scan.BootReceiver.onReceive
(Unknown Source)
W/System.err(19190):    at android.app.ActivityThread.handleReceiver(ActivityThr
ead.java:2119)
W/System.err(19190):    at android.app.ActivityThread.access$1500(ActivityThread
.java:123)
W/System.err(19190):    at android.app.ActivityThread$H.handleMessage(ActivityTh
read.java:1197)
W/System.err(19190):    at android.os.Handler.dispatchMessage(Handler.java:99)
W/System.err(19190):    at android.os.Looper.loop(Looper.java:137)
W/System.err(19190):    at android.app.ActivityThread.main(ActivityThread.java:4
424)
W/System.err(19190):    at java.lang.reflect.Method.invokeNative(Native Method)
W/System.err(19190):    at java.lang.reflect.Method.invoke(Method.java:511)
W/System.err(19190):    at com.android.internal.os.ZygoteInit$MethodAndArgsCalle
r.run(ZygoteInit.java:787)
W/System.err(19190):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.ja

 2、 java.lang.IllegalStateException: 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. [in ListView(2131493171, class android.widget.ListView) with Adapter

这个问题出现在onresume的时候使用AsyncTask,点击item到下一个界面,按back返回的时候,出现bug。

 

这个修改的时候加个判断当adpter不为空时notifyDataSetChanged,为空的时候就重新new.

 

3、

添加文件到Sdcard出现Failed to push selection: Invalid argument问题

用DDMS添加文件到内存卡里提示

 Failed to push the item(s).

解决方案:
把内存卡的容量加大,重启eclipse就OK了。

补充:如果提示Failed to push selection: Invalid argument
说明你的路径中包括中文,请把中文全改为英文。导入的时候不要有空格 ,或者直接将APK拖到 File Explorer的sdcard里面。
4、java.lang.ArithmeticException: divide by zero: 算数异常
  
5、java.lang.IllegalStateException: get field slot from row 0 col 0  failed当数据库查询结果大于1M的时候,会报这个错误。
解决办法:查询的时候限制结果列,不要查出所有的列,只查询自己需要的。
String  abcname = "abc";

Cursor c = db.query("table", new String[]{age, agender,heighth}, "name"+"=?", new String[]{abcname}, null, null, null);

 

 

6、  android sqlite查询数据时报错:   get field slot from row 0 col -1 failed ,  
     i nt id = cursor.getInt(cursor.getColumnIndex(ID)); , 此处是获取ID的值, 查看上面代码后发现查询字段中没有查询ID字段,而现在又要获取这个字段的值,所以报了这个错误
获得查询有限制的时候,缺少列导致。
7、java.lang.IllegalStateException: 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.
解决办法:list变了,立马就得notifyDataSetChanged。
类似于clear()之后就马上notifyDataSetChanged。
8、Syntax error, insert ")" to complete Expression
    分号打错位置了。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值