我正在创建一个使用ARCA接收崩溃报告的算术例外。我已经使用Arcalyzer在Cloudant设置了后端。崩溃后,根据LogCat的说法,崩溃报告已发送,但在Arcalyzer仪表板上没有显示任何报告。无法弄清楚此代码有什么问题。
mainapp:
@ReportsCrashes(
formUri = "https://terrybogard911.cloudant.com/acra-faheemcallrecorder/_design/acra-storage/_update/report",
reportType = HttpSender.Type.JSON,
httpMethod = HttpSender.Method.POST,
formUriBasicAuthLogin = ""//Login,
formUriBasicAuthPassword = ""//Password,
customReportContent = {
ReportField.APP_VERSION_CODE,
ReportField.APP_VERSION_NAME,
ReportField.ANDROID_VERSION,
ReportField.PACKAGE_NAME,
ReportField.REPORT_ID,
ReportField.BUILD,
ReportField.STACK_TRACE
},
mode = ReportingInteractionMode.TOAST,
resToastText = R.string.toast_crash
)
public class MainApp extends Application {
@Override
public void onCreate() {
super.onCreate();
ACRA.init(this);
}
}
logcat:
09-14 01:32:08.546 19876-19876/com.tookmesomuchtime.javaprogramming.rashidfaheem.hybridsoftwaresolutions.hbss.rashidfaheem.faheemcallrecorder E/ACRA: ACRA caught a ArithmeticException for com.tookmesomuchtime.javaprogramming.rashidfaheem.hybridsoftwaresolutions.hbss.rashidfaheem.faheemcallrecorder
java.lang.ArithmeticException: divide by zero
at com.tookmesomuchtime.javaprogramming.rashidfaheem.hybridsoftwaresolutions.hbss.rashidfaheem.faheemcallrecorder.MainActivity.onOptionsItemSelected(MainActivity.java:228)
at android.app.Activity.onMenuItemSelected(Activity.java:2644)
at android.support.v4.app.FragmentActivity.onMenuItemSelected(FragmentActivity.java:408)
at android.support.v7.app.AppCompatActivity.onMenuItemSelected(AppCompatActivity.java:195)
at android.support.v7.view.WindowCallbackWrapper.onMenuItemSelected(WindowCallbackWrapper.java:113)
at android.support.v7.app.AppCompatDelegateImplV9.onMenuItemSelected(AppCompatDelegateImplV9.java:679)
at android.support.v7.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.java:822)
at android.support.v7.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:156)
at android.support.v7.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:969)
at android.support.v7.view.menu.MenuPopup.onItemClick(MenuPopup.java:127)
at android.widget.AdapterView.performItemClick(AdapterView.java:299)
at android.widget.AbsListView.performItemClick(AbsListView.java:1158)
at android.widget.AbsListView$PerformClick.run(AbsListView.java:2957)
at android.widget.AbsListView$3.run(AbsListView.java:3849)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5107)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:792)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:608)
at dalvik.system.NativeStart.main(Native Method)
09-14 01:32:08.546 19876-19876/com.tookmesomuchtime.javaprogramming.rashidfaheem.hybridsoftwaresolutions.hbss.rashidfaheem.faheemcallrecorder D/ACRA: Building report
09-14 01:32:08.556 19876-19876/com.tookmesomuchtime.javaprogramming.rashidfaheem.hybridsoftwaresolutions.hbss.rashidfaheem.faheemcallrecorder D/ACRA: Using custom Report Fields
09-14 01:32:08.646 19876-19876/com.tookmesomuchtime.javaprogramming.rashidfaheem.hybridsoftwaresolutions.hbss.rashidfaheem.faheemcallrecorder I/ACRA: READ_LOGS granted! ACRA can include LogCat and DropBox data.
09-14 01:32:08.646 19876-19876/com.tookmesomuchtime.javaprogramming.rashidfaheem.hybridsoftwaresolutions.hbss.rashidfaheem.faheemcallrecorder D/ACRA: Writing crash report file 1505334728000.stacktrace.
09-14 01:32:08.656 19876-19876/com.tookmesomuchtime.javaprogramming.rashidfaheem.hybridsoftwaresolutions.hbss.rashidfaheem.faheemcallrecorder D/ACRA: About to start ReportSenderWorker from #handleException
09-14 01:32:08.666 19876-20036/com.tookmesomuchtime.javaprogramming.rashidfaheem.hybridsoftwaresolutions.hbss.rashidfaheem.faheemcallrecorder D/ACRA: Mark all pending reports as approved.
09-14 01:32:08.666 19876-20036/com.tookmesomuchtime.javaprogramming.rashidfaheem.hybridsoftwaresolutions.hbss.rashidfaheem.faheemcallrecorder D/ACRA: Looking for error files in /data/data/com.tookmesomuchtime.javaprogramming.rashidfaheem.hybridsoftwaresolutions.hbss.rashidfaheem.faheemcallrecorder/files
09-14 01:32:08.676 19876-20036/com.tookmesomuchtime.javaprogramming.rashidfaheem.hybridsoftwaresolutions.hbss.rashidfaheem.faheemcallrecorder D/ACRA: #checkAndSendReports - start
09-14 01:32:08.696 19876-20037/com.tookmesomuchtime.javaprogramming.rashidfaheem.hybridsoftwaresolutions.hbss.rashidfaheem.faheemcallrecorder D/ACRA: Waiting for 2000 millis from 1505334728625 currentMillis=1505334728707
09-14 01:32:08.696 19876-20039/com.tookmesomuchtime.javaprogramming.rashidfaheem.hybridsoftwaresolutions.hbss.rashidfaheem.faheemcallrecorder D/ACRA: Waiting for Toast
09-14 01:32:08.696 19876-20036/com.tookmesomuchtime.javaprogramming.rashidfaheem.hybridsoftwaresolutions.hbss.rashidfaheem.faheemcallrecorder D/ACRA: Looking for error files in /data/data/com.tookmesomuchtime.javaprogramming.rashidfaheem.hybridsoftwaresolutions.hbss.rashidfaheem.faheemcallrecorder/files
09-14 01:32:08.696 19876-20036/com.tookmesomuchtime.javaprogramming.rashidfaheem.hybridsoftwaresolutions.hbss.rashidfaheem.faheemcallrecorder I/ACRA: Sending file 1505334728000-approved.stacktrace
09-14 01:32:08.766 19876-20036/com.tookmesomuchtime.javaprogramming.rashidfaheem.hybridsoftwaresolutions.hbss.rashidfaheem.faheemcallrecorder D/ACRA: Connect to https://terrybogard911.cloudant.com/acra-faheemcallrecorder/_design/acra-storage/_update/report
09-14 01:32:08.796 19876-20036/com.tookmesomuchtime.javaprogramming.rashidfaheem.hybridsoftwaresolutions.hbss.rashidfaheem.faheemcallrecorder D/ACRA: Sending request to https://terrybogard911.cloudant.com/acra-faheemcallrecorder/_design/acra-storage/_update/report
09-14 01:32:08.806 19876-20036/com.tookmesomuchtime.javaprogramming.rashidfaheem.hybridsoftwaresolutions.hbss.rashidfaheem.faheemcallrecorder E/DataScheduler: isDataSchedulerEnabled():false
09-14 01:32:09.576 19876-20036/com.tookmesomuchtime.javaprogramming.rashidfaheem.hybridsoftwaresolutions.hbss.rashidfaheem.faheemcallrecorder V/TlsSniSocketFactory: Setting allowed TLS protocols: TLSv1, TLSv1.1, TLSv1.2
09-14 01:32:09.576 19876-20036/com.tookmesomuchtime.javaprogramming.rashidfaheem.hybridsoftwaresolutions.hbss.rashidfaheem.faheemcallrecorder V/TlsSniSocketFactory: Setting allowed TLS ciphers: TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_DHE_RSA_WITH_AES_128_CBC_SHA, TLS_ECDH_RSA_WITH_AES_128_CBC_SHA, TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA, SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA, SSL_RSA_EXPORT_WITH_RC4_40_MD5, SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA, TLS_DHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDH_RSA_WITH_AES_256_CBC_SHA, SSL_RSA_WITH_RC4_128_SHA, TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA, SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, SSL_DHE_DSS_WITH_DES_CBC_SHA, TLS_ECDHE_RSA_WITH_RC4_128_SHA, TLS_ECDH_ECDSA_WITH_RC4_128_SHA, TLS_DHE_DSS_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA, SSL_DHE_RSA_WITH_DES_CBC_SHA, TLS_ECDHE_ECDSA_WITH_RC4_128_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_256_CBC_SHA, SSL_RSA_WITH_DES_CBC_SHA, TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA, TLS_EMPTY_RENEGOTIATION_INFO_SCSV, TLS_ECDH_RSA_WITH_RC4_128_SHA, SSL_RSA_EXPORT_WITH_DES40_CBC_SHA, TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA, SSL_RSA_WITH_RC4_128_MD5, TLS_DHE_DSS_WITH_AES_128_CBC_SHA, SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA, SSL_RSA_WITH_3DES_EDE_CBC_SHA
09-14 01:32:09.576 19876-20036/com.tookmesomuchtime.javaprogramming.rashidfaheem.hybridsoftwaresolutions.hbss.rashidfaheem.faheemcallrecorder D/TlsSniSocketFactory: Using documented SNI with host name terrybogard911.cloudant.com
09-14 01:32:10.266 19876-20036/com.tookmesomuchtime.javaprogramming.rashidfaheem.hybridsoftwaresolutions.hbss.rashidfaheem.faheemcallrecorder I/TlsSniSocketFactory: Established TLSv1.2 connection with terrybogard911.cloudant.com using TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA
09-14 01:32:10.636 19876-20036/com.tookmesomuchtime.javaprogramming.rashidfaheem.hybridsoftwaresolutions.hbss.rashidfaheem.faheemcallrecorder D/ACRA: #checkAndSendReports - finish
09-14 01:32:10.706 19876-20039/com.tookmesomuchtime.javaprogramming.rashidfaheem.hybridsoftwaresolutions.hbss.rashidfaheem.faheemcallrecorder D/ACRA: Finished waiting for Toast
09-14 01:32:10.706 19876-20039/com.tookmesomuchtime.javaprogramming.rashidfaheem.hybridsoftwaresolutions.hbss.rashidfaheem.faheemcallrecorder D/ACRA: Waiting for Worker
09-14 01:32:10.706 19876-20039/com.tookmesomuchtime.javaprogramming.rashidfaheem.hybridsoftwaresolutions.hbss.rashidfaheem.faheemcallrecorder D/ACRA: Finished waiting for Worker
09-14 01:32:10.706 19876-20039/com.tookmesomuchtime.javaprogramming.rashidfaheem.hybridsoftwaresolutions.hbss.rashidfaheem.faheemcallrecorder D/ACRA: Wait for Toast + worker ended. Kill Application ? true
w/acra:403:客户端错误 - 请求将被丢弃
这意味着服务器已达到但拒绝操作。
可能的原因包括:
- 您的身份验证是针对没有必要角色的用户(即
reporter
) - 由于HTTPS配置故障,服务器拒绝了连接
请参阅http 403禁止
添加此版本
dependencies {
testCompile 'junit:junit:4.12'
compile 'ch.acra:acra:4.9.2'
}
不要忘记添加
<uses-permission android:name="android.permission.INTERNET"/>
在以下覆盖方法
中添加ACRA INIT @Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
// The following line triggers the initialization of ACRA
ACRA.init(this);
System.out.println("application initialized ACRA");
}