我升级了我的应用程序使用的 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,好像是ACRA 4.6.0的bug
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.
我刚刚将依赖项升级到 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 - 从 ACRA 4.5 升级到 ACRA 4.6 后出现编译错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30157931/