encorej / acra

Automatically exported from code.google.com/p/acra
0 stars 0 forks source link

Mode Toast Compile Fail #134

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Set the ReportsCrashes in mode toast:
@ReportsCrashes(formKey="dGVacG0ydVHnaNHjRjVTUTEtb3FPWGc6MQ",
                mode = ReportingInteractionMode.TOAST,
                forceCloseDialogAfterToast = false, // optional, default false
                resToastText = R.string.crash_toast_text)
2. Add the crash text in string.xml
<string name="crash_toast_text">Ooooops ! I crashed, but a report has been sent 
to my developer to help fix the issue !</string>

3. Error:
The value for annotation attribute ReportsCrashes.resToastText must be a 
constant 
 expression

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?
4.3.2

Please provide any additional information below.

Original issue reported on code.google.com by eurekain...@gmail.com on 30 Jul 2012 at 8:15

GoogleCodeExporter commented 8 years ago
You're going to need to provide more information.
It sounds like your build paths are out of whack.
I don't believe it is an ACRA issue at all. Lots of people (including myself) 
use exactly this config.

Original comment by william....@gmail.com on 2 Aug 2012 at 9:03

GoogleCodeExporter commented 8 years ago
Ok.

Please tell me how can i check my build path. I can use the 
@ReportsCrashes(formKey = "MY KEY") without any problem. I am using Android 2.2 
and ACRA 4.2.3

Thank you

Original comment by eurekain...@gmail.com on 2 Aug 2012 at 11:12

Attachments:

GoogleCodeExporter commented 8 years ago
as of ADT 14 those R fields are not constants in library projects.  Have you 
recently marked the project as such in your project properties?

Original comment by castillo...@gmail.com on 7 Aug 2012 at 5:39

GoogleCodeExporter commented 8 years ago
Ok! Now works perfect! I read about the problem and the solution is quite 
simple, just declare the value of the toast in the app projects and not in the 
library.

Thank you very much and sorry I didn't remember that change.

Original comment by eurekain...@gmail.com on 7 Aug 2012 at 6:05

GoogleCodeExporter commented 8 years ago
Thanks for solving this issue ;-)

Original comment by kevin.gaudin on 8 Aug 2012 at 3:40

GoogleCodeExporter commented 8 years ago
> as of ADT 14 those R fields are not constants in library projects
Good catch! Saved me hours!

Btw, if you still need to set resToastText in your library project, you can 
call "ACRA.getConfig().setResToastText(R.string.crash_toast_text);" just after 
"ACRA.init(this);" ;)

Original comment by alex.fra...@gmail.com on 2 Sep 2012 at 8:23

GoogleCodeExporter commented 8 years ago
I think it will save hours too:

No, 

ACRA.init(this);
ACRA.getConfig().setResToastText(R.string.crash_toast_text); 

doesn't work. 

And to make the project "non-library" is not a good solution. I have for 
example a couple of distributions of one app. For every of these distributions 
exists a project. So, in this situation it would be better to define such a 
string in a library, instead of do it for every project. 

Original comment by v.kalasc...@gmail.com on 21 Mar 2014 at 2:46

GoogleCodeExporter commented 8 years ago
ACRA.getConfig().setResToastText(R.string.crash_toast_text); 

will work,
you need to define in @ReportsCrashes:
resToastText = 1;

in order to pass the init validation.

it's a dirty hack.

Original comment by rne...@gmail.com on 8 Oct 2014 at 2:05