vedhavyas / acra

Automatically exported from code.google.com/p/acra
0 stars 0 forks source link

Add some documentation about disabling ACRA in debug mode #80

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
If you run an open source project, you probably don't want to receive crash 
reports from other developers that are experimenting with the code and crashing 
the app for random reasons.

In our project we have used this:

@Override
public void onCreate() {
    // The following line triggers the initialization of ACRA
    if (!isDebug())
        ACRA.init(this);
        super.onCreate();
}

public boolean isDebug() {
    return ((getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) > 0);
}

In this way, ACRA is only enabled when the app is signed with a release key, 
and it avoids the developing reports.

Maybe something like this could be added directly to ACRA, or just add some 
info about it on the wiki pages. :)

By the way, we are really enjoining to use ACRA, it's a great project and the 
results are really impressive. Thank you all, good job!

Original issue reported on code.google.com by fceca...@gmail.com on 25 Sep 2011 at 10:35

GoogleCodeExporter commented 8 years ago
I second this. I've been using android.os.Debug.isDebuggerConnected() as the 
test to prevent initialization when running through the IDE.

If you do this though, you can't call 
ErrorReporter.getInstance().handleException() or you will get a null pointer 
error, so you need to check for debug mode there as well.

Perhaps we could add an ACRA initialization option such as 
activeWhenDebuggerConnected and default it to true (for legacy compatibility)?

Original comment by rupert.r...@gmail.com on 9 Jan 2012 at 9:35

GoogleCodeExporter commented 8 years ago
I agree to add an option to let you disable ACRA in debug/dev mode, but the 
default behavior should be to let ACRA activated unless the option is set.

I think I prefer the method described by fcecagno. It disables sending reports 
while using your app in development, be it connected to the debugger or not.

Original comment by kevin.gaudin on 14 Jan 2012 at 12:02

GoogleCodeExporter commented 8 years ago

Original comment by kevin.gaudin on 14 Jan 2012 at 12:02

GoogleCodeExporter commented 8 years ago
Actuall I do want our other devs to send us reports. What I do not want is 
include acra in the release APK. I want to enable/disable acra by the CI server.
This is not easy because you cannot add/remove the annotation automatically.
My proposal: Configure ACRA not by annotation but by an additional text file. 
If the text/config file exists (e.g. acra.config) then use it, otherwise don't.
Then I can strip the JAR from the release build, and I'm almost done. For the 
ARCA.init() not to fail, I could include my own JAR that has nothing more than 
this method but is empty.
What do you think?

Original comment by peter.v...@gmail.com on 14 Jan 2012 at 8:44

GoogleCodeExporter commented 8 years ago

Original comment by kevin.gaudin on 7 Sep 2012 at 9:31