Ⅰ android手机日志怎么查看
以小米手机为例,其他机型操作方法大致相同:
1.首先在手机桌面上找到【文件管理】,进入手机的文件管理页面。
Ⅱ 怎么查看手机软件运行日志
使用Android studio查看手机的日志可参考以下步骤:
1、打开android studio随便进入一个工程进入主界面
Ⅲ android 错误日志 哪里
1、创建MyCrashHandler类
package com.example.yu.myapplication;
import android.content.Context;
import android.os.Environment;
import android.util.Log;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.lang.Thread.UncaughtExceptionHandler;
import java.util.Date;
/**
* 全局捕获导常,保存到本地错误日志。日志
* 路径位于sdcard/错误日志Log/myErrorLog下。
*/
public class MyCrashHandler implements UncaughtExceptionHandler {
private static MyCrashHandler instance;
public static MyCrashHandler getInstance() {
if (instance == null) {
instance = new MyCrashHandler();
}
return instance;
}
public void init(Context ctx) {
Thread.(this);
}
/**
* 核心方法,当程序crash 会回调此方法, Throwable中存放这错误日志
*/
@Override
public void uncaughtException(Thread arg0, Throwable arg1) {
String logPath;
if (Environment.getExternalStorageState().equals(
Environment.MEDIA_MOUNTED)) {
logPath = Environment.getExternalStorageDirectory()
.getAbsolutePath()
+ File.separator
+ File.separator
+ "错误日志Log";
File file = new File(logPath);
if (!file.exists()) {
file.mkdirs();
}
try {
FileWriter fw = new FileWriter(logPath + File.separator
+ "myErrorlog.log", true);
fw.write(new Date() + "错误原因:\n");
// 错误信息
// 这里还可以加上当前的系统版本,机型型号 等等信息
StackTraceElement[] stackTrace = arg1.getStackTrace();
fw.write(arg1.getMessage() + "\n");
for (int i = 0; i < stackTrace.length; i++) {
fw.write("file:" + stackTrace[i].getFileName() + " class:"
+ stackTrace[i].getClassName() + " method:"
+ stackTrace[i].getMethodName() + " line:"
+ stackTrace[i].getLineNumber() + "\n");
}
fw.write("\n");
fw.close();
// 上传错误信息到服务器
// uploadToServer();
} catch (IOException e) {
Log.e("crash handler", "load file failed...", e.getCause());
}
}
arg1.printStackTrace();
android.os.Process.killProcess(android.os.Process.myPid());
}
}
Ⅳ android studio怎样查看logcat错误日志
紧抓关键词,准确定位
1、寻找causeBy
2、往下寻找自己工程里面的类,查看后面的说明,如方法报错,参数报错等等
3、找到相应位置的代码,思考自己代码错误的存在可能
4、debug,到相应的位置进行断点跟踪。
Ⅳ 如何查看android产生的异常
android程序如果出问题,因为实际是java程序,所以会抛出异常,比如这样。
弹出的警告对话框中没有异常信息,如果需要看到日志内容,可执行:
“adb logcat”
即可见到异常信息。或者通过ddms,通过device》run logcat通过图形界面查看日志,和上面的命令效果一样。(比如http://www.tiecou.com)
这是一个异常的内容:
W/dalvikvm(26121): threadid=3: thread exiting with uncaught exception (group=0x4000fe70)
E/AndroidRuntime(26121): Uncaught handler: thread main exiting e to uncaught exception
E/AndroidRuntime(26121): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.easymorse.activity/com.easymorse.activity.ActivityTest}: java.lang.SecurityException: Requires READ_PHONE_STATE: Neither user 10032 nor current process has android.permission.READ_PHONE_STATE.
E/AndroidRuntime(26121): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2268)
E/AndroidRuntime(26121): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2284)
E/AndroidRuntime(26121): at android.app.ActivityThread.access$1800(ActivityThread.java:112)
E/AndroidRuntime(26121): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1692)
E/AndroidRuntime(26121): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(26121): at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime(26121): at android.app.ActivityThread.main(ActivityThread.java:3948)
E/AndroidRuntime(26121): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(26121): at java.lang.reflect.Method.invoke(Method.java:521)
E/AndroidRuntime(26121): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782)
E/AndroidRuntime(26121): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
E/AndroidRuntime(26121): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime(26121): Caused by: java.lang.SecurityException: Requires READ_PHONE_STATE: Neither user 10032 nor current process has android.permission.READ_PHONE_STATE.
E/AndroidRuntime(26121): at android.os.Parcel.readException(Parcel.java:1234)
E/AndroidRuntime(26121): at android.os.Parcel.readException(Parcel.java:1222)
E/AndroidRuntime(26121): at com.android.internal.telephony.IPhoneSubInfo$Stub$Proxy.getLine1Number(IPhoneSubInfo.java:223)
E/AndroidRuntime(26121): at android.telephony.TelephonyManager.getLine1Number(TelephonyManager.java:498)
E/AndroidRuntime(26121): at com.easymorse.activity.ActivityTest.onCreate(ActivityTest.java:18)
E/AndroidRuntime(26121): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123)
E/AndroidRuntime(26121): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2231)
E/AndroidRuntime(26121): … 11 more
Ⅵ android 程序报错后产生的日志如何查看
如果程序出现强制关闭的错误,一般系统会保留出错log,但是你需要root之后才能看得到,也可以运行sdk自带的debug工具:ddms.bat来看日志。
如果你是开发人员,eclipse中就有logcat来看日志
Ⅶ 如何查看手机的出错日志
在开始--控制面板--性能和维护--管理工具,选择事件查看器就可以查看了!
Ⅷ 如何查看android手机模拟器往控制台输出的日志信息
很多种方法都可以的。最常见的是在eclipse中直接查看
菜单--》 windows--》 show VIew --》 other 找到 android logcat 选项,选上就可以在log标签里查看了
也可以在CMD中输入adb logcat (目录切换到sdk/tools下, 例如:c:android-for-windows\tools ,adb logcat &)
最后的&,可以不加。