android 异常错误积累

1.   java.net.SocketException: Noroute to host

重新开一下wifi就可以了.

2.

[plain]  view plain copy
  1. Failed to install xxx.apk on device '040398FE1701701F': Unable to open sync connection!  
  2. java.io.IOException: Unable to open sync connection!  
  3. Launch canceled!  

重新打开usb调试就可以了.

3.
[plain]  view plain copy
  1. res\values\style.xml:44:error: Error retrieving parent for item: No resource found that matches the given name 'android:WindowTitleBackground'  

Style.xml里

[html]  view plain copy
  1. <style name="iWindowTitleBackground"parent="android:WindowTitleBackground">     
  2.         <item name="android:background">@drawable/title_bar</item>         
  3. </style>  
"android:WindowTitleBackground" >改为 "*android:WindowTitleBackground" >就可以了.

参照:http://topic.csdn.net/u/20110830/15/f12f7679-8857-4010-ac6e-88b8f52244e8.html


4.
[java]  view plain copy
  1. [2010-03-23 11:57:49 - Poc]Re-installation failed due to different application signatures.  
  2. [2010-03-23 11:57:49 - Poc]You must perform a full uninstall of the application. WARNING: This will remove the application data!  
  3. [2010-03-23 11:57:49 - Poc]Please execute 'adb uninstall com.xue.test' in a shell.  
  4. [2010-03-23 11:57:49 - Poc]Launch canceled!  

删除手机中的这个工程即可

5.

[java]  view plain copy
  1. 12-29 13:59:31.929: ERROR/AndroidRuntime(5594): Caused by: android.app.SuperNotCalledException: Activity {com.test.lthandmap/com.test.lthandmap.poisearch.PoiInfoListActivity} did not call through to super.onResume()  
  2. 12-29 13:59:31.929: ERROR/AndroidRuntime(5594):     at android.app.Activity.performResume(Activity.java:3858)  
  3. 12-29 13:59:31.929: ERROR/AndroidRuntime(5594):     at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2127)  
  4. 12-29 13:59:31.929: ERROR/AndroidRuntime(5594):     ... 12 more  

重写onResume()后,super.onResume()删掉了所导致这个异常,加上就可以了.

6.手机有时候连不上,需要重启adb


7.

[java]  view plain copy
  1. Caused by: java.lang.ClassCastException: android.widget.LinearLayout$LayoutParams  

最近,在android中用代码动态改变某种布局(组件)的高度时,会遇到如题所示的类转换异常。上网查了一下,如下所示:

These supply parameters to the parent of this view specifying how it should be arranged. There are many subclasses of ViewGroup.LayoutParams, and these correspond to the different subclasses of ViewGroup that are responsible for arranging their children.

So basically, if you are adding a view to another, you MUST set the LayoutParams of the view to the LayoutParams type that the parent uses, or you will get a runtime error.

  我是这样理解的,如果你要将一个view添加到另一个布局中,你必须设定该View的布局参数为其父类所使用的布局参数类型。即要在代码中动态改变某组件的高度,其布局参数类型应该是其父类所使用的布局参数类型。

view设置了 LayoutParams,他的父控件也需要设置

8.TabHost添加3个及以上tab时报的异常

[java]  view plain copy
  1. Caused by: java.lang.IllegalArgumentException: you must specify a way to create the tab content  
  2. at android.widget.TabHost.addTab(TabHost.java:219)  
看TabHost源码可知mContentStrategy=null,所以改下写法

原来的写法

[java]  view plain copy
  1. TabSpec ts1 = tabhost.newTabSpec(TAB1).setIndicator(TAB1);  
  2.         ts1.setContent(new Intent(BottomMenu_ArrowTop.this, TestViewFlipper.class));  
  3.         tabhost.addTab(ts1);  
改写后的写法

[java]  view plain copy
  1. tabhost.addTab(tabhost.newTabSpec(TAB1)  
  2.                 .setIndicator(TAB1)  
  3.                 .setContent(new Intent(this,TestViewFlipper.class)));  

9.jni 方法调用错误

[java]  view plain copy
  1. 02-28 23:02:52.218: ERROR/AndroidRuntime(27159): java.lang.UnsatisfiedLinkError: unimplementedStringFromJNI  
在jni里没有unimplementedStringFromJNI方法

转载自: http://blog.csdn.net/ethan_xue/article/details/7069048
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值