Android:需要帮助实施ACRA

时间:2014-02-04 05:18:28

标签: java android acra

我是Android开发的新手。我正在尝试实施ACRA以进行错误报告。我已经编写了以下代码来将ACRA集成到项目中。

   @ReportsCrashes 
   (
    formKey = "",
    reportType = org.acra.sender.HttpSender.Type.JSON,
    httpMethod = org.acra.sender.HttpSender.Method.PUT,
    formUri = "localhost:5984/acra-mediwatch/_design/acra-storage/_update/report",
    formUriBasicAuthLogin = "admin",
    formUriBasicAuthPassword = "admin"        
    )

问题是它在本地工作正常但服务器URL(例如208.109.91.98:5984而不是localhost:5984)在指定时给出了以下错误:

02-04 04:56:24.741: E/ACRA(979): Failed to send crash report for 1391489780000-approved.stacktrace
02-04 04:56:24.741: E/ACRA(979): org.acra.sender.ReportSenderException: Error while sending JSON report via Http PUT
02-04 04:56:24.741: E/ACRA(979):    at org.acra.sender.HttpSender.send(HttpSender.java:228)
02-04 04:56:24.741: E/ACRA(979):    at org.acra.SendWorker.sendCrashReport(SendWorker.java:179)
02-04 04:56:24.741: E/ACRA(979):    at org.acra.SendWorker.checkAndSendReports(SendWorker.java:141)
02-04 04:56:24.741: E/ACRA(979):    at org.acra.SendWorker.run(SendWorker.java:77)
02-04 04:56:24.741: E/ACRA(979): Caused by: org.apache.http.conn.ConnectTimeoutException: Connect to /208.109.91.98:5984 timed out
02-04 04:56:24.741: E/ACRA(979):    at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:121)
02-04 04:56:24.741: E/ACRA(979):    at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:144)
02-04 04:56:24.741: E/ACRA(979):    at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164)
02-04 04:56:24.741: E/ACRA(979):    at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119)
02-04 04:56:24.741: E/ACRA(979):    at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:360)
02-04 04:56:24.741: E/ACRA(979):    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
02-04 04:56:24.741: E/ACRA(979):    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
02-04 04:56:24.741: E/ACRA(979):    at org.acra.util.HttpRequest.send(HttpRequest.java:152)
02-04 04:56:24.741: E/ACRA(979):    at org.acra.sender.HttpSender.send(HttpSender.java:225)
02-04 04:56:24.741: E/ACRA(979):    ... 3 more

我无法从这个日志中猜出我哪里出错了。有关如何使其适用于服务器的任何想法?帮助赞赏。

2 个答案:

答案 0 :(得分:0)

问题是,为什么它会为您的设备超时?

是否有网络连接?也许您需要增加ACRA SocketTimeout配置。我认为默认值是3000或5000毫安。如果你把它增加到10,000毫升有帮助吗?

更多细节here

答案 1 :(得分:0)

表单的路径是否正确写入?你还记得在清单中添加这两个权限吗?:

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