我尝试使用ACRA将崩溃日志发送到cloudant很多天但是无论我尝试什么,我总是在logcat中遇到某种错误。
以下是MyApplication的代码: -
package com.greenday.lyrics;
import org.acra.*;
import org.acra.annotation.*;
import android.app.Application;
@ReportsCrashes(
formKey="",
formUri = "https://vishal007.cloudant.com/acra-greenday/_design/acra-storage/_update/report",
formUriBasicAuthLogin = "thallyindshareaseriblyst", // optional
formUriBasicAuthPassword = "FYS5kV5cL5nR4IHFUHWRdO3j", // optional
reportType = org.acra.sender.HttpSender.Type.JSON,
httpMethod = org.acra.sender.HttpSender.Method.PUT,
customReportContent = {
ReportField.APP_VERSION_CODE,
ReportField.APP_VERSION_NAME,
ReportField.ANDROID_VERSION,
ReportField.PACKAGE_NAME,
ReportField.REPORT_ID,
ReportField.BUILD,
ReportField.STACK_TRACE,
ReportField.APPLICATION_LOG
},
mode = ReportingInteractionMode.TOAST,
forceCloseDialogAfterToast = false, // optional, default false
resToastText = R.string.crash_toast_text,
applicationLogFile = "/data/data/com.greenday.lyrics/files/log/extra.log"
)
public class MyApplication extends Application {
@Override
public void onCreate() {
// TODO Auto-generated method stub
super.onCreate();
// The following line triggers the initialization of ACRA
ACRA.init(this);
}
}
以下是我得到的logcat:
01-22 00:54:33.909: I/ACRA(22547): Sending file 1390331334000-approved.stacktrace
01-22 00:54:33.959: D/ACRA(22547): Connect to https://vishal007.cloudant.com/acra- greenday/_design/acra-storage/_update/report
01-22 00:54:34.079: D/ACRA(22547): Sending request to https://vishal007.cloudant.com/acra-greenday/_design/acra-storage/_update/report/4f7c6c82- 6e05-43d8-9b57-5549600d57f2
01-22 00:54:35.330: E/ACRA(22547): Failed to send crash report for 1390331334000- approved.stacktrace
01-22 00:54:35.330: E/ACRA(22547): org.acra.sender.ReportSenderException: Error while sending JSON report via Http PUT
01-22 00:54:35.330: E/ACRA(22547): at org.acra.sender.HttpSender.send(HttpSender.java:228)
01-22 00:54:35.330: E/ACRA(22547): at org.acra.SendWorker.sendCrashReport(SendWorker.java:179)
01-22 00:54:35.330: E/ACRA(22547): at org.acra.SendWorker.checkAndSendReports(SendWorker.java:141)
01-22 00:54:35.330: E/ACRA(22547): at org.acra.SendWorker.run(SendWorker.java:77)
01-22 00:54:35.330: E/ACRA(22547): Caused by: java.io.IOException: Host returned error code 404
01-22 00:54:35.330: E/ACRA(22547): at org.acra.util.HttpRequest.send(HttpRequest.java:173)
01-22 00:54:35.330: E/ACRA(22547): at org.acra.sender.HttpSender.send(HttpSender.java:225)
01-22 00:54:35.330: E/ACRA(22547): ... 3 more
01-22 00:54:35.330: D/ACRA(22547): #checkAndSendReports - finish
01-22 00:54:35.370: D/ACRA(22547): Wait for Toast + worker ended. Kill Application ? true
01-22 00:54:35.370: E/ACRA(22547): com.greenday.lyrics fatal error : Unable to find explicit activity class {com.greenday.lyrics/com.greenday.nimrod.Prosthetichead}; have you declared this activity in your AndroidManifest.xml?
但是当我尝试
时formUri = "https://vishal007.cloudant.com/acra-greenday/"
而不是
formUri = "https://vishal007.cloudant.com/acra-greenday/_design/acra- storage/_update/report"
我在acra-greenday数据库中收到了大量文档。至少我得到了什么,但我无法理解。另外,我无法附加我的自定义日志。 但无论如何,这种形式都不起作用。