How to send Android Crash report using ACRA

人盡茶涼 提交于 2019-12-02 21:23:13
Alexander Kulyakhtin

ACRA works for me sending reports by e-mail when I do exactly as they say in their docs:

@ReportsCrashes(mailTo = "reports@yourdomain.com", // my email here
                mode = ReportingInteractionMode.TOAST,
                resToastText = R.string.crash_toast_text)

https://github.com/ACRA/acra/wiki/Report-Destinations#sending-reports-by-email

You are probably forgetting the toast part. Or can it be you don't have an e-mail program (such as when you're running on the simulator).

I think sending reports by Google docs are not supported anymore.

Hitesh Sahu

Your application class should look like this.

import android.app.Application;

    import org.acra.ACRA;
    import org.acra.ReportField;
    import org.acra.ReportingInteractionMode;
    import org.acra.annotation.ReportsCrashes;


    @ReportsCrashes(mailTo = "user@domain.com", customReportContent = {
            ReportField.APP_VERSION_CODE, ReportField.APP_VERSION_NAME,
            ReportField.ANDROID_VERSION, ReportField.PHONE_MODEL,
            ReportField.CUSTOM_DATA, ReportField.STACK_TRACE, ReportField.LOGCAT},
            mode = ReportingInteractionMode.TOAST, resToastText = R.string.crash_toast_text)
    public class MyApplication extends Application {

        @Override
        public void onCreate() {
            super.onCreate();
            ACRA.init(this);
        }
    }

No,not like Alex say,the mode property has no releation to the reporting type,you can see it in the source code in github using the mailTo type,you should make sure that:

  1. your app has the permission to connect network;
  2. have an e-mail program in your device like Alex say;
  3. have you invoked the ACRA.init(this) method in your application's oncreate()?

if all of these have done,then run your app,it will note you to configure the email,such as username and password and so on.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!