编程语言
首页 > 编程语言> > java – 从ACRA 4.5升级到ACRA 4.6后的编译错误

java – 从ACRA 4.5升级到ACRA 4.6后的编译错误

作者:互联网

我升级了我的应用程序使用的ACRA库
4.5.0到4.6.0但是我收到了formKey的编译错误
曾经与4.5一起工作.

这是宣言:

@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,
)

这是错误:

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

我尝试删除formKey,因为它已不再使用了,
来自声明,但是在我这样做之后它产生了一个新的错误.

解决方法:

检查ACRA ChangeLog后,似乎是4.6.0中的ACRA错误

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.

我刚刚将dependecies升级到4.6.2,错误消失了.
您还需要从注释声明中删除formKey.

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,
)

标签:java,android,acra
来源: https://codeday.me/bug/20190612/1222737.html