lenovo联想官方网站

一、lenovo联想官方网站

尊敬的联想用户您好!

为您提供联想官方链接:

ideapad:http://appserver.lenovo.com.cn/Lenovo_Brand_List.aspx?CategoryID=1

Thinkpad:http://appserver.lenovo.com.cn/Lenovo_Brand_List.aspx?CategoryID=3

lenovo联想官方网站

服务网点查询链接:

http://support1.lenovo.com.cn/lenovo/wsi/station/servicestation/default.aspx

更多问题您可以咨询

idea论坛:http://lenovobbs.lenovo.com.cn/forum.php?intcmp=FM_LBBS_baidureply

Think论坛:http://thinkbbs.lenovo.com.cn/forum.php?intcmp=FM_LBBS_baidureply

联想乐社区:http://bbs.lenovomobile.com/forum.php?intcmp=FM_LBBS_baidureply

期待您满意的评价,感谢您对联想的支持,祝您生活愉快!

二、企业软件报错上传日志

1我们在使用真机调试的时候如果不建立adb连接是很难查看程序报出的错误信息的,我们通过使用此方法可以将错误日志捕获并且存储到本地或者上传到服务器。

2.当我们的应用程序上线,可能会因为机型问题导致我们的程序出现问题,我们可以通过此方法来将错误日志上传到我们服务器上,通过查看日志来使我们不断的完善我们的APP

代码实现

一般在application中调用此方法

Thread.setDefaultUncaughtExceptionHandler(AppException.getAppExceptionHandler());

登录后复制

异常处理的主类

/

* @Description 应用程序异常类:用于捕获异常和提示错误信息

* @author lhn

* @created 2016-5-21

*/

public class AppException extends Exception implements UncaughtExceptionHandler {

private static final long serialVersionUID = 1L;

/ 系统默认的UncaughtException处理类 */

private Thread.UncaughtExceptionHandler mDefaultHandler;

/** 无参的构造函数 */

private AppException() {

this.mDefaultHandler = Thread.getDefaultUncaughtExceptionHandler();

}

/** 有参的构造函数 */

private AppException(Exception excp) {

super(excp);

this.saveErrorLog(excp);

}

/

* @Description 保存异常日志

*

* @param Exception

* excp(异常日志)

*/

public void saveErrorLog(Exception excp) {

//定义错误日志文件存储信息

String errorlog = “errorlog.txt”;

String savePath = “”;

String logFilePath = “”;

//文件输出

FileWriter fw = null;

PrintWriter pw = null;

try {

// 判断是否挂载了SD卡

String storageState = Environment.getExternalStorageState();

if (storageState.equals(Environment.MEDIA_MOUNTED)) {

//设置存储路径

savePath = Environment.getExternalStorageDirectory()

.getAbsolutePath() + “/OSChina/Log/”;

//实例化File

File file = new File(savePath);

if (!file.exists()) {

//创建此抽象路径名指定的目录,包括所有必需但不存在的父目录。

file.mkdirs();

}

//日志路径

logFilePath = savePath + errorlog;

}

// 没有挂载SD卡,无法写文件

if (logFilePath == “”) {

return;

}

//实例化logFile

File logFile = new File(logFilePath);

//判断是否已经存在

if (!logFile.exists()) {

logFile.createNewFile();

} else {

logFile.delete();

logFile.createNewFile();

}

//实例化文件输出

fw = new FileWriter(logFile, true);

pw = new PrintWriter(fw);

//在命令行打印异常信息在程序中出错的位置及原因

excp.printStackTrace(pw);

//释放资源

pw.close();

fw.close();

} catch (Exception e) {

e.printStackTrace();

} finally {

if (pw != null) {

pw.close();

}

if (fw != null) {

try {

fw.close();

} catch (IOException e) {

}

}

}

//结束此错误Activity

ActivityCollector.finishAll();

}

/

* @Description 获取APP异常崩溃处理对象

*

* @return AppException

*/

public static AppException getAppExceptionHandler() {

return new AppException();

}

@Override

public void uncaughtException(Thread thread, Throwable ex) {

//如果异常没有被处理

if (!handleException(ex) && mDefaultHandler != null) {

//进行异常捕获

mDefaultHandler.uncaughtException(thread, ex);

}

}

/

* @Description 自定义异常处理:收集错误信息&发送错误报告

*

* @param Throwable

* ex(异常信息)

* @return true:处理了该异常信息;否则返回false

*/

private boolean handleException(Throwable ex) {

if (ex == null) {

return false;

}

// APP崩溃异常报告

final String crashReport = getCrashReport(

OneLeadPosApplication.getOneLeadPosApplication(), ex);

// 错误信息存储到本地

saveErrorLog((Exception) ex);

// 显示异常信息&发送报告(上传到服务器)

// new Thread() {

// public void run() {

// Looper.prepare();

// UIHelper.sendAppCrashReport(context, crashReport);

// Looper.loop();

// }

//

// }.start();

return true;

}

/

* @Description 获取APP崩溃异常报告

*

* @param Context

* context(上下文), Throwable ex(异常信息)

* @return String

*/

private String getCrashReport(Context context, Throwable ex) {

StringBuffer exceptionStr = new StringBuffer();

// android版本以及系统型号

exceptionStr.append(“Android: ” + android.os.Build.VERSION.RELEASE

+ “(” + android.os.Build.MODEL + “)\n”);

// 异常信息

exceptionStr.append(“Exception: ” + ex.getMessage() + “\n”);

//?

StackTraceElement[] elements = ex.getStackTrace();

for (int i = 0; i < elements.length; i++) {

exceptionStr.append(elements[i].toString() + “\n”);

}

// 返回组成的StringBuffer

return exceptionStr.toString();

}

}

本站所有文章资讯、展示的图片素材等内容均为注册用户上传(部分报媒/平媒内容转载自网络合作媒体),仅供学习参考。 用户通过本站上传、发布的任何内容的知识产权归属用户或原始著作权人所有。如有侵犯您的版权,请联系我们反馈本站将在三个工作日内改正。