简体   繁体   English

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

[英]Compilation error after upgrading from ACRA 4.5 to ACRA 4.6

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. 我将我的应用程序使用的ACRA库从4.5.0升级到4.6.0但是我收到了一个用于4.5的formKey的编译错误。

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() 错误:(19,17)错误:找不到符号方法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. 我试图从声明中删除formKey,因为它不再使用了,但是在我这样做之后它会产生一个新的错误。

After checking the ACRA ChangeLog , it seems to be bug of ACRA in 4.6.0 检查ACRA ChangeLog后,似乎是4.6.0中的ACRA错误

PR#233 PR#235 Allowing the location of BuildConfig to be configurable to support Gradle build flavours. PR#233 PR#235允许BuildConfig的位置可配置以支持Gradle构建风格。 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. 注意:如果您正在捕获BuildConfig,那么这是一个重大变化,您的Application类不会驻留在原始AndroidManifest清单中定义的Java包中:package属性。 In that scenario you will need to explicitly configure 'buildConfigClass' in your ACRA config. 在这种情况下,您需要在ACRA配置中显式配置“buildConfigClass”。

I just upgraded the dependecies to 4.6.2 and the error was gone. 我刚刚将dependecies升级到4.6.2,错误消失了。 You also need to remove the formKey from the annotation declaration. 您还需要从注释声明中删除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,
)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM