android 简单调试中用到的 Log.

android.util.Log常用的方法有以下5个:Log.v() Log.d() Log.i() Log.w() 以及 Log.e() 。根据首字母对应VERBOSE,DEBUG,INFO, WARN,ERROR。


1、Log.v 的调试颜色为黑色的,任何消息都会输出,这里的v代表verbose啰嗦的意思,平时使用就是Log.v("","");


2、Log.d的输出颜色是蓝色的,仅输出debug调试的意思,但他会输出上层的信息,过滤起来可以通过DDMS的Logcat标签来选择.


3、Log.i的输出为绿色,一般提示性的消息information,它不会输出Log.v和Log.d的信息,但会显示i、w和e的信息


4、Log.w的意思为橙色,可以看作为warning警告,一般需要我们注意优化Android代码,同时选择它后还会输出Log.e的信息。


5、Log.e为红色,可以想到error错误,这里仅显示红色的错误信息,这些错误就需要我们认真的分析,查看栈的信息了。
帮我看一下这个报错:06-12 03:36:49.417 5514 5514 E AndroidRuntime: Process: wifip2p.wifi.com.wifip2p, PID: 5514 06-12 03:36:49.417 5514 5514 E AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{wifip2p.wifi.com.wifip2p/wifip2p.wifi.com.wifip2p.activity.SendFileActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'android.net.wifi.p2p.WifiP2pManager$Channel android.net.wifi.p2p.WifiP2pManager.initialize(android.content.Context, android.os.Looper, android.net.wifi.p2p.WifiP2pManager$ChannelListener)' on a null object reference 06-12 03:36:49.417 5514 5514 E AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3469) 06-12 03:36:49.417 5514 5514 E AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3663) 06-12 03:36:49.417 5514 5514 E AndroidRuntime: at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85) 06-12 03:36:49.417 5514 5514 E AndroidRuntime: at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) 06-12 03:36:49.417 5514 5514 E AndroidRuntime: at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) 06-12 03:36:49.417 5514 5514 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2067) 06-12 03:36:49.417 5514 5514 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:106) 06-12 03:36:49.417 5514 5514 E AndroidRuntime: at android.os.Looper.loop(Looper.java:272) 06-12 03:36:49.417 5514 5514 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:7971) 06-12 03:36:49.417 5514 5514 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method) 06-12 03:36:49.417 5514 5514 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:604) 06-12 03:36:49.417 5514 5514 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:986) 06-12 03:36:49.417 5514 5514 E AndroidRuntime: Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.net.wifi.p2p.WifiP2pManager$Channel android.net.wifi.p2p.WifiP2pManager.initialize(android.content.Context, android.os.Looper, android.net.wifi.p2p.WifiP2pManager$ChannelListener)' on a null object reference
最新发布
06-13
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值