繁体   English   中英

Android设置ACRA来获取应用程序错误和崩溃不起作用

[英]Android setup ACRA to get application bugs and crashes doesnt work

下面的代码是我的简单设置ACRA,用于获取崩溃和应用程序错误,但是设置acra不会发送任何报告

@ReportsCrashes(
        /*LOCALHOST*/
        formUri = "http://192.168.1.35/acra.php/acra.php",
        customReportContent = {ReportField.APP_VERSION_CODE, ReportField.APP_VERSION_NAME, ReportField.ANDROID_VERSION, ReportField.PHONE_MODEL, ReportField.CUSTOM_DATA, ReportField.STACK_TRACE, ReportField.LOGCAT},
        mode = ReportingInteractionMode.DIALOG)

public class EpayApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        ACRA.init(this);
    }
}

本地主机php文件:

<?php
    // Outputs all POST parameters to a text file. The file name is the date_time of the report reception
    $fileName = date('Y-m-d_H-i-s').'.txt';
    $file = fopen($fileName,'w') or die('Could not create report file: ' . $fileName);
    foreach($_POST as $key => $value) {
    $reportLine = $key." = ".$value."\n";
        fwrite($file, $reportLine) or die ('Could not write to report file ' . $reportLine);
    }
    fclose($file);
?>

输入http://192.168.1.35/acra.php/acra.php可以创建一个空文件,并且获取报告没有任何问题,我的acra版本是4.9.0

我的清单:

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

<application
    android:name=".AppApplication"

android:name属性的值应与您创建的应用程序类名称相同。 您的情况有所不同。

改变这个

android:name=".AppApplication"

android:name=".EpayApplication"

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM