以任何方式将Android抛出的异常日志上传到服务器

时间:2013-06-24 09:59:19

标签: android logging

有没有办法将Android抛出的异常日志上传到服务器?

问候

5 个答案:

答案 0 :(得分:2)

查看ACRABugSense

答案 1 :(得分:2)

您可以在Google Play商店的“例外/ ANR”中查看简要报告

还建议使用Google Analytics

它非常易于使用,并且能够通过在XML中将值设置为true来记录所有未捕获的异常

答案 2 :(得分:0)

Crittercism可以满足您的需求而无需采用复杂的方式。只需下载库,然后集成它。

与Google Play商店相比,它易于集成,更加可靠。 Crittercism捕获所有异常,线程堆栈(以便您可以检查是否有任何线程无所事事)以及设备类型。与Play商店相比,我提到了大约1%的崩溃事件。

另一方面,与乱舞相比,谷歌分析更加沉重。我推荐一系列乱舞和暴击。

答案 3 :(得分:0)

如果您不想使用第三方库,您可以自己捕捉异常并随心所欲地做任何事情 -

UncaughtExceptionHandler currentHandler = Thread.getDefaultUncaughtExceptionHandler();
        // Register if not already registered
        if (!(currentHandler instanceof ExceptionHandler)) {
            Thread.setDefaultUncaughtExceptionHandler(new ExceptionHandler(this, currentHandler));
        }

在Application类中执行此操作。

答案 4 :(得分:0)

在Android中,Google正式支持使用Fabrics's crashlytics Firebase在线工具// basic settings for your Zendesk $userName = 'xxxxx@xxxx.com/token'; $apiKey = 'xkalkjsdXASJKDlasaknfkajsfASASASD'; // upload file info $fileName = 'v5.0.zip'; $filePath = 'path/to/file/v5.0.zip'; $url = 'https://mysubdomain.zendesk.com/api/v2/apps/uploads.json'; $file = fopen($filePath, "r"); $size = filesize($filePath); $ch = curl_init($url); curl_setopt($ch, CURLOPT_USERPWD, $userName.":".$apiKey); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: application/binary')); curl_setopt($ch, CURLOPT_FOLLOWLOCATION ,1); curl_setopt($ch, CURLOPT_HEADER, 0); // DO NOT RETURN HTTP HEADERS curl_setopt($ch, CURLOPT_RETURNTRANSFER ,1); // RETURN THE CONTENTS OF THE CALL curl_setopt($ch, CURLOPT_BINARYTRANSFER, TRUE); curl_setopt($ch, CURLOPT_POSTFIELDS, array($fileName => "@".$filePath)); curl_setopt($ch, CURLOPT_USERAGENT, "MozillaXYZ/1.0"); $output = curl_exec($ch); $code = curl_getinfo($ch, CURLINFO_HTTP_CODE); fclose($file); curl_close($ch); 来管理与崩溃相关的信息。我们也可以将任何异常上传到服务器。

此外,他们还提供了一个仪表板,用于显示与我们的应用程序相关的许多内容。