【发布时间】:2016-06-29 19:49:35
【问题描述】:
以下代码是我的简单设置 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"
【问题讨论】: