Closed GoogleCodeExporter closed 8 years ago
Well, it doesn't crash for the "acra.disable" settings. That's very weird,
because I had a look into the files ACRA.java and ErrorReporter.java, and I
don't see the cause.
Original comment by lueghau...@gmail.com
on 9 Feb 2011 at 1:12
Where is your call to ACRA.init(Application) placed exactly ?
I see there could be in issue in some cases because the
OnSharedPreferenceChangeListener is just before really intializing the
ErrorReporter.
So if a preference change occurs just before the init, the applicationContext
might not have been provided to the ErrorReporter... => NPE.
I've not been able to reproduce the crash, so the details of your
Application.onCreate() method could help me.
Anyway, I will fix the init sequence so that the listener is set AFTER the
ErrorReporter init... and add a test on the context to prevent any other case
of NPE on this log entry.
I still haven't decided if I will release a fixed package for this or just
include it in the incoming features release.
Original comment by kevin.gaudin
on 12 Feb 2011 at 2:07
I had it at two places:
1) In the onCreate() method, I changed the "acra.enable" prefences like
if (beta)
prefs.edit().putBoolean("acra.enable", true).commit();
else if (!prefs.contains("acra.enable"))
// Disable it by default
prefs.edit().putBoolean("acra.enable", false).commit();
The last line produced the crash.
2) I placed it simply as CheckBoxPreference in the preferences xml layout
<CheckBoxPreference android:key="acra.enable"
android:title="@string/pref_enable_acra"
android:summaryOn="@string/pref_acra_enabled"
android:summaryOff="@string/pref_acra_disabled"
android:defaultValue="false"/>
Unchecking the CheckBoxPreference crashed the application.
Original comment by lueghau...@gmail.com
on 12 Feb 2011 at 2:19
Please send me the content of your Application.onCreate() method (where
ACRA.init() is called) kevin.gaudin@gmail.com.
Thanks
Original comment by kevin.gaudin
on 12 Feb 2011 at 2:22
package com.example.app;
import org.acra.ACRA;
import org.acra.ReportingInteractionMode;
import org.acra.annotation.ReportsCrashes;
import android.app.Application;
@ReportsCrashes(formKey="",
formUri="http://www.example.com/report.php",
mode = ReportingInteractionMode.TOAST,
resToastText = R.string.crash_report_sent,
resNotifTickerText = R.string.crash_notif_ticker_text,
resNotifTitle = R.string.crash_notif_title,
resNotifText = R.string.crash_notif_text,
resNotifIcon = android.R.drawable.stat_notify_error, // optional. default is a warning sign
resDialogText = R.string.crash_dialog_text,
resDialogIcon = android.R.drawable.ic_dialog_info, //optional. default is a warning sign
resDialogTitle = R.string.crash_dialog_title, // optional. default is your application name
resDialogCommentPrompt = R.string.crash_dialog_comment_prompt, // optional. when defined, adds a user text field input with this text resource as a label
resDialogOkToast = R.string.crash_dialog_ok_toast // optional. displays a Toast message when the user accepts to send a report.
)
public class MyApplication extends Application {
public static final boolean BETA_VERSION = true;
@Override
public void onCreate() {
// The following line triggers the initialization of ACRA
ACRA.init(this);
super.onCreate();
}
}
Original comment by lueghau...@gmail.com
on 12 Feb 2011 at 3:00
Nothing wrong here. If you are able to reproduce the crash anytime, I could
send you a new .jar and let you check that my fix works. Would that be ok for
you ?
Original comment by kevin.gaudin
on 12 Feb 2011 at 4:22
Original comment by kevin.gaudin
on 17 Feb 2011 at 6:56
Just released a 3.1.1 version. See Downloads page. Please check that the fix
works.
Original comment by kevin.gaudin
on 18 Feb 2011 at 1:40
I have the last version 4.2.3 "Stable".
I found out that to prevent ACRA from crashing you have to initializate
ErrorReporter first:
@Override
public void onCreate() {
ErrorReporter.getInstance().init(this);
ACRA.init(this); // The following line triggers the initialization of ACRA
}
With this ACRA stop producing NullPointerException type of exceptions.
I don't know if this would change the behavior of ACRA or not. I wish there
would be a test method that allow the developer to check is ACRA is working
propertly or not.
Original comment by david.w....@gmail.com
on 31 Oct 2011 at 8:30
Original comment by kevin.gaudin
on 22 Dec 2011 at 9:06
Original issue reported on code.google.com by
lueghau...@gmail.com
on 9 Feb 2011 at 12:44