ACRA / acra

Application Crash Reports for Android
https://www.acra.ch
Apache License 2.0
6.31k stars 1.14k forks source link

Acra on android library modules #715

Closed ahmed56734 closed 5 years ago

ahmed56734 commented 5 years ago

I am working on an android library, I want to know if it's possible to use Acra to detect and collect crashes related to my library not the app module ?

F43nd1r commented 5 years ago

Should be possible by registering a custom ReportingAdministrator which filters out everything except those with your package name in the stacktrace.

A more common pattern would be to have app developers catch crashes as they want to and let them report to upstream if a library is causing issues.

ahmed56734 commented 5 years ago

screen shot 2018-11-25 at 4 22 38 pm

@F43nd1r 1- I tried to extend the reportingAdministrator but I don't know how to get the package name of the collected report ?

2- finally how to register that custom Administrator

F43nd1r commented 5 years ago

Override shouldStartCollecting with something like


    class MyAdmin implements ReportingAdministrator {

        @Override
        public boolean shouldStartCollecting(@NonNull Context context, @NonNull CoreConfiguration config, @NonNull ReportBuilder reportBuilder) {
            if (reportBuilder.getException() != null) {
                StringWriter stringWriter = new StringWriter();
                reportBuilder.getException().printStackTrace(new PrintWriter(stringWriter));
                return stringWriter.toString().contains("your.package.name");
            }
            return false;
        }
    }
F43nd1r commented 5 years ago
  1. https://github.com/ACRA/acra/wiki/Custom-Extensions#registering-an-extension
ahmed56734 commented 5 years ago

screen shot 2018-11-26 at 1 31 23 pm can't find the auto-service annotation processor classpath anywhere

ahmed56734 commented 5 years ago

@F43nd1r

F43nd1r commented 5 years ago

https://docs.gradle.org/4.6/release-notes.html#convenient-declaration-of-annotation-processor-dependencies

ahmed56734 commented 5 years ago

screen shot 2018-11-29 at 1 17 20 pm I already did that

F43nd1r commented 5 years ago

It is auto-service, not auto-service-compile

On Thu, 29 Nov 2018, 12:22 ahmed <notifications@github.com wrote:

[image: screen shot 2018-11-29 at 1 17 20 pm] https://user-images.githubusercontent.com/10393214/49218531-51c33300-f3d9-11e8-9731-f493229c93e3.png I already did that

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ACRA/acra/issues/715#issuecomment-442798761, or mute the thread https://github.com/notifications/unsubscribe-auth/AJxxpCW_wPzUidnhk7O26cgO3q3C5KtZks5uz8NegaJpZM4YvP7v .