I am trying to convert my application project to library, I am getting errors like
resDialogTitle = R.string.crash_dialog_title,
The value for annotation attribute ReportsCrashes.resDialogTitle must be a constant expression
They are used in ACRA header
@ReportsCrashes(formKey = "--", mode = ReportingInteractionMode.DIALOG, mailTo = "--", customReportContent = {
ReportField.APP_VERSION_CODE, ReportField.APP_VERSION_NAME,
ReportField.ANDROID_VERSION, ReportField.PHONE_MODEL,
ReportField.CUSTOM_DATA, ReportField.STACK_TRACE, ReportField.LOGCAT }
// resToastText = R.string.crash_toast_text, // optional, displayed as soon as
// the crash occurs, before collecting data which can take a few seconds
resDialogText = getString(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 MainAppClass extends Application {
private static MainAppClass singleton;
How to fix this?
In ACRA, since ADT 14, R fields are not constants in library project. 2 solutions:
eg:
Remember to call ACRA.init(this); in your onCreate() method.
You can set all the fields you need this way. Check here.