android 常见异常

1    遇到问题描述:

运行android程序控制台输出

    [2012-07-18 16:18:26 - ] The connection to adb is down, and a severe error has occured.
    [2012-07-18 16:18:26 - ] You must restart adb and Eclipse.
    [2012-07-18 16:18:26 - ] Please ensure that adb is correctly located at 'D:\java\sdk\platform-tools\adb.exe' and can be executed.









C:\Users\Administrator>adb kill-server

C:\Users\Administrator>adb start-server
* daemon not running. starting it now on port 5037 *
* daemon started successfully *

C:\Users\Administrator>





2   .报错:
BUILD FAILED
D:\workspace\ganji\build.xml:144: The following error occurred while executing this line:
D:\workspace\ganji\build.xml:271: Unable to delete file D:\workspace\ganji\tmp\proguard\tmp.jar
解决:
已经开了一个模拟器了,无法重新编译,必须关闭一个。

3.
014-04-18 18:19:04 - unknow] Failed to install unknow.apk on device '2091d019': timeout
[2014-04-18 18:19:04 - unknow] Launch canceled!

解决:
重启eliplise


4.
[2014-04-18 18:51:06 - MainActivity] Android requires compiler compliance level 5.0 or 6.0. Found '1.7' instead. Please use Android Tools > Fix Project Properties.
[2014-04-18 18:51:08 - MainActivity] Android requires compiler compliance level 5.0 or 6.0. Found '1.7' instead. Please use Android Tools > Fix Project Properties.
[2014-04-18 18:51:19 - MainActivity] Android requires compiler compliance level 5.0 or 6.0. Found '1.7' instead. Please use Android Tools > Fix Project Properties.
[2014-04-18 18:51:21 - MainActivity] Android requires compiler compliance level 5.0 or 6.0. Found '1.7' instead. Please use Android Tools > Fix Project Properties.
[2014-04-18 18:52:40 - MainActivity] Android requires compiler compliance level 5.0 or 6.0. Found '1.7' instead. Please use Android Tools > Fix Project Properties.
[2014-04-18 18:52:41 - MainActivity] Android requires compiler compliance level 5.0 or 6.0. Found '1.7' instead. Please use Android Tools > Fix Project Properties.



5.
xml文件中的id问题(解决方法 :纠正id:   检查加载布局文件是否正确)

04-20 13:12:15.015: E/AndroidRuntime(3840): FATAL EXCEPTION: main
04-20
13:12:15.015: E/AndroidRuntime(3840): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.adaptall/com.example.adaptall.Arraydx}: java.lang.NullPointerException
04-20

 13:12:15.015: E/AndroidRuntime(3840):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2080)
04-20 13:12:15.015: E/AndroidRuntime(3840):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2105)
04-20 13:12:15.015: E/AndroidRuntime(3840):     at android.app.ActivityThread.access$600(ActivityThread.java:136)
04-20 13:12:15.015: E/AndroidRuntime(3840):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1201)
04-20 13:12:15.015: E/AndroidRuntime(3840):     at android.os.Handler.dispatchMessage(Handler.java:99)
04-20 13:12:15.015: E/AndroidRuntime(3840):     at android.os.Looper.loop(Looper.java:137)
04-20 13:12:15.015: E/AndroidRuntime(3840):     at android.app.ActivityThread.main(ActivityThread.java:4875)
04-20 13:12:15.015: E/AndroidRuntime(3840):     at java.lang.reflect.Method.invokeNative(Native Method)
04-20 13:12:15.015: E/AndroidRuntime(3840):     at java.lang.reflect.Method.invoke(Method.java:511)
04-20 13:12:15.015: E/AndroidRuntime(3840):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:804)
04-20 13:12:15.015: E/AndroidRuntime(3840):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:571)
04-20 13:12:15.015: E/AndroidRuntime(3840):     at dalvik.system.NativeStart.main(Native Method)
04-20 13:12:15.015: E/AndroidRuntime(3840): Caused by: java.lang.NullPointerException
04-20 13:12:15.015: E/AndroidRuntime(3840):     at com.example.adaptall.Arraydx.onCreate(Arraydx.java:19)
04-20 13:12:15.015: E/AndroidRuntime(3840):     at android.app.Activity.performCreate(Activity.java:5082)
04-20 13:12:15.015: E/AndroidRuntime(3840):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
04-20 13:12:15.015: E/AndroidRuntime(3840):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2044)
04-20 13:12:15.015: E/AndroidRuntime(3840):     ... 11 more


6.类型不匹配异常GridView 中//设置布局宽高时要注意 LayoutParams方法是那个类的
04-21 13:02:26.883: E/AndroidRuntime(19013): java.lang.ClassCastException: android.view.ViewGroup$LayoutParams cannot be cast to android.widget.AbsListView$LayoutParams


7.
活动用intent连接 但清单文件未注册 ---解决 ---注册清单文件

04-30 08:48:33.788: E/AndroidRuntime(22356): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.l_g/com.example.l_g.Activity01}; have you declared this activity in your AndroidManifest.xml?



8.
[2014-05-23 08:51:46 - ExtenalStorageDemo] Android requires compiler compliance level 5.0 or 6.0. Found '1.7' instead. Please use Android Tools > Fix Project Properties.

解决方案:


今天在eclipse里报这个错误:
Android requires compiler compliance level 5.0 or 6.0. Found '1.4' instead. Please fix project properties

1. 项目 右键 ->android tools ->Fix Project
2. 如果不可以,检查Project -> Properties->Java Compiler

确认JDK compliance被设置为1.6,并且enable specific seetings.


------------------------------------
adb默认端口5037

1>5037端口使用情况
netstat -aon|findstr "5037"
2》占用5037端口的应用那个程序
tasklist|findstr "4024"

3》杀死占用端口程序
taskkill /f /im eclipse.exe

9.
java.io.FileNotFoundException: /mnt/sdcard/Pictures/1403230541317.jpg: open failed: EACCES (Permission denied)

家权限



10.



Incorrect line ending: found carriage return (\r) without corresponding newline (\n)解决办法
分类: android 2013-04-08 01:58 4071人阅读 评论(5) 收藏 举报

详细提示如下:

Incorrect line ending: found carriage return (\r) without corresponding newline (\n)


: Incorrect line ending: found carriage return (\r) without corresponding newline 编辑 删除
2013-03-17
 

由于ADT版本问题,若打开layout时 如果提示:Incorrect line ending: found carriage return (\r) without corresponding newline (\n)

 

 

解决方案: ——clean一下项目,这个方法可以解决 。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值