Cannot resolve method 'formKey' in ACRA 4.

2019-05-11 13:10发布

i tried setting up acra for my android project today, but it didnt work. I followed the instructions, importet the acra lib in gradle (compile 'ch.acra:acra:4.7.0') Then i added this:

@ReportsCrashes(formKey = "", mailTo = "mail@adress.com", mode = ReportingInteractionMode.NOTIFICATION)
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ACRA.init(this.getApplication());

I get the error Cannot resolve method 'formKey', but when deleting formkey from parameters, i get @ReportsCrashes not applicable to method

I also tried

@ReportsCrashes(formUri = "http://www.yourselectedbackend.com/reportpath")

and

@ReportsCrashes(formKey = "", formUri = "http://www.yourselectedbackend.com/reportpath")

and get the same errors. Anyone knows the issue/solution? The wiki at https://github.com/ACRA/acra/wiki seems outdated and there is no issue about this.

1条回答
放荡不羁爱自由
2楼-- · 2019-05-11 13:27

formKey has been removed for some time. I don't know where you saw instructions to use it, but they should no longer exist too. Use formUri.

You are getting @ReportsCrashes not applicable to method because you have annotated your onCreate method. You need to annotate your Application class

查看更多
登录 后发表回答