我是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
我无法从我出错的地方猜测。关于如何使其适用于服务器的任何想法?帮助赞赏。
问题是,为什么要为您的设备计时?
它有净连接吗?也许您需要增加ACRA Sockettimeout配置。我认为默认值为3000或5000毫米。如果将其增加到10,000毫里,它会有所帮助吗?
更多详细信息
是否正确编写表单的路径?您是否记得在清单中添加这两个权限?:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_LOGS" />