Closed GoogleCodeExporter closed 8 years ago
I did not test with Proguard at all.
Do you have some interesting traces in the LogCat ?
Original comment by kevin.gaudin
on 8 Dec 2010 at 10:48
ProGuard in only included when doing a 'release build' where you export the
project to a .APK file and then install it with 'ADB Install ProgramName' to an
emulator or a real device. So, when I install from a release .APK file, ACRA
does *not* show up in LogCat. However, if I run it from Eclipse LogCat does
show ACRA messages including writing crash report, connecting to google
spreadsheets, posting crash data, etc. So, either I'm just not configuring
ProGuard correctly (and it is pulling out the ARCA calls which I don't see it
doing in the generated 'usage.txt' file it creates) or possibly ACRA doesn't
support obfuscation like this. I think it is probably my ProGuard
configuration but I thought I would ask to see if it was something that was
know to work or not...
Thanks again
Original comment by ping...@gmail.com
on 9 Dec 2010 at 12:24
Ok, I'll have to test that.
Original comment by kevin.gaudin
on 9 Dec 2010 at 12:30
Thanks! I will keep playing around with different configurations of ProGuard
and will post back if I find something that works. I'm not sure in the end if
it does work what it will look like in the google spreadsheet for the call
stack but I want to see if I can decipher it using some the of the SDK tools...
Original comment by ping...@gmail.com
on 9 Dec 2010 at 12:35
I just read that ProGuard considers Annotations as optional and removes them.
ACRA v3 configuration system is based on a Runtime visible Annotation which is
read during the execution of ACRA.init(Application app) via reflection API.
So, from the examples given at
http://proguard.sourceforge.net/manual/examples.html#annotations I guess you
should add -keepattributes *Annotation* to your ProGuard conf.
Could you please test again with this parameter ?
Original comment by kevin.gaudin
on 9 Dec 2010 at 1:48
Thanks but I had no luck with adding -keepattributes *Annotation*. I even
tried:
-keepattributes Exceptions,InnerClasses,Signature,Deprecated,
SourceFile,LineNumberTable,*Annotation*,EnclosingMethod
So far the only thing that seems to "keep" ACRA is:
-dontobfuscate
-dontoptimize
(so ProGuard is only shrinking)
I will keep playing around with other settings to see if I can get it to work
with obfuscating and / or optimizing...
Original comment by ping...@gmail.com
on 9 Dec 2010 at 3:01
I spoke too soon. By including -keepattributes *Annotation* it does get
further and calls into the ACRA.init but then crashes in that call. I thought
this was my code crashing as I have a bit of code to cause a crash at start up
and I didn't look at the LogCat close enough. The current problem is it
doesn't know what "SILENT" is so that must be getting removed I would guess.
Here is the stack trace from where I'm calling ACRA.init within my onCreate:
FATAL EXCEPTION: main
java.lang.NoSuchFieldError: SILENT
at java.lang.reflect.Method.getDefaultValue(Native Method)
at java.lang.reflect.Method.getDefaultValue(Method.java:337)
at org.apache.harmony.lang.annotation.AnnotationFactory.getElementsDescription(AnnotationFactory.java:78)
at org.apache.harmony.lang.annotation.AnnotationFactory.<init>(AnnotationFactory.java:118)
at org.apache.harmony.lang.annotation.AnnotationFactory.createAnnotation(AnnotationFactory.java:100)
at java.lang.Class.getDeclaredAnnotations(Native Method)
at java.lang.Class.getAnnotations(Class.java:322)
at java.lang.Class.getAnnotation(Class.java:292)
at org.acra.ACRA.a(SourceFile:115)
Original comment by ping...@gmail.com
on 9 Dec 2010 at 3:45
I guess the enum has been obfuscated. Here is the corresponding ProGuard
example:
http://proguard.sourceforge.net/manual/examples.html#enumerations
Original comment by kevin.gaudin
on 9 Dec 2010 at 6:44
Hmmmm... I already have:
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
So I'm not sure why it can't find it. I will keep looking...
Thanks for helping!
Original comment by ping...@gmail.com
on 9 Dec 2010 at 7:04
Looks like the enum names are being obfuscated.
from my mapping.txt file
1990 org.acra.ReportingInteractionMode -> org.acra.c:
1991 org.acra.ReportingInteractionMode SILENT -> a
1992 org.acra.ReportingInteractionMode NOTIFICATION -> b
1993 org.acra.ReportingInteractionMode TOAST -> c
1994 org.acra.ReportingInteractionMode[] ENUM$VALUES -> d
1995 1:1:org.acra.ReportingInteractionMode[] values() -> values
1996 1:1:org.acra.ReportingInteractionMode valueOf(java.lang.String) ->
valueOf
-keep class org.acra.ReportingInteractionMode {
*;
}
fixes it for me.
Original comment by tj.mccon...@gmail.com
on 13 Dec 2010 at 5:07
That did the trick! Thanks!
Original comment by ping...@gmail.com
on 14 Dec 2010 at 2:46
Would anyone write a wiki doc on using ACRA with Proguard ?
Original comment by kevin.gaudin
on 22 Dec 2010 at 12:45
I can try. How do you create a wiki page on the ACRA site?
Original comment by ping...@gmail.com
on 22 Dec 2010 at 12:14
Please send me your email (the one which is associated with your googlecode
account) to kevin.gaudin@gmail.com. I'll add you to the project's contributors
and give you the rights to modify wiki pages.
Thanks!
Original comment by kevin.gaudin
on 22 Dec 2010 at 1:44
Wiki has been updated with details on how to make ACRA work with Proguard.
Original comment by william....@gmail.com
on 16 Jul 2011 at 5:59
And here is the wiki page:
https://github.com/ACRA/acra/wiki/ProGuard
Original comment by nick.h...@gmail.com
on 23 Jan 2013 at 11:21
Original issue reported on code.google.com by
ping...@gmail.com
on 8 Dec 2010 at 10:43