简体   繁体   中英

Android : Need help in implementing ACRA

I am new to Android development. I am trying to implement ACRA for error reporting purpose. I have written following code to integrate ACRA within the project.

   @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"        
    )

The problem is it's working fine locally but server URL (eg 208.109.91.98:5984 instead of localhost:5984) when specified gives me following error:

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

I am not able to guess from this log where I am going wrong. Any ideas regarding how can I make it work for server? Help appreciated.

The question is, why is it timing out for your device?

Does it have a net connection? Perhaps you need to increase the ACRA SocketTimeout config. I think default is 3000 or 5000 millis. If you increase that to 10,000 millis does it help?

More detail here

Is the path to the form written correctly? DId you remember to add these two permissions in the manifest?:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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