Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compilation error after upgrading from ACRA 4.5 to ACRA 4.6

Tags:

java

android

acra

I upgraded the ACRA library used by my application from 4.5.0 to 4.6.0 but I am getting a compilation error for formKey which used to work with 4.5.

Here is the declaration:

@ReportsCrashes(
  formKey = "",
  formUri = "",
  socketTimeout = 10000,
  httpMethod = org.acra.sender.HttpSender.Method.POST,
  mode = ReportingInteractionMode.SILENT,
  resDialogText = R.string.crash_dialog_text,
  resDialogIcon = android.R.drawable.ic_dialog_info,
  resDialogTitle = R.string.crash_dialog_title,
  resDialogCommentPrompt = R.string.crash_dialog_comment_prompt,
)

Here is the error:

Error:(19, 17) error: cannot find symbol method formKey()

I tried removing the formKey, as it is not used anymore, from the declaration but it's producing a new error after I did that.

like image 935
Christian Abella Avatar asked Mar 17 '23 02:03

Christian Abella


1 Answers

After checking the ACRA ChangeLog , it seems to be bug of ACRA in 4.6.0

PR#233 PR#235 Allowing the location of BuildConfig to be configurable to support Gradle build flavours. NB This is a breaking change IF your are capturing BuildConfig AND your Application class does not reside in the Java package defined in your original AndroidManifest manifest:package attribute. In that scenario you will need to explicitly configure 'buildConfigClass' in your ACRA config.

I just upgraded the dependecies to 4.6.2 and the error was gone. You also need to remove the formKey from the annotation declaration.

dependencies {
  compile 'ch.acra:acra:4.6.2'
}


@ReportsCrashes(
  formUri = "",
  socketTimeout = 10000,
  httpMethod = org.acra.sender.HttpSender.Method.POST,
  mode = ReportingInteractionMode.SILENT,
  resDialogText = R.string.crash_dialog_text,
  resDialogIcon = android.R.drawable.ic_dialog_info,
  resDialogTitle = R.string.crash_dialog_title,
  resDialogCommentPrompt = R.string.crash_dialog_comment_prompt,
)
like image 103
Christian Abella Avatar answered Mar 30 '23 01:03

Christian Abella