Skip to content
F43nd1r edited this page May 19, 2021 · 12 revisions

Documentation has moved! Visit acra.ch for versions 5.8 forward


Using ACRA with ProGuard

Introduction

This Wiki will show you how to use ACRA with ProGuard enabled. It does not try to explain all the details of using ProGuard as there are many other good resources for that including:

http://proguard.sourceforge.net/index.html

http://developer.android.com/guide/developing/tools/proguard.html

http://android-developers.blogspot.com/2010/09/proguard-android-and-licensing-server.html

It also assumes you have ACRA installed in your project and setup correctly. If you don't have ACRA setup please read the how to first.

Details

ACRA already ships with an optimal proguard configuration, all you have to do is

Test ACRA with ProGuard

Don't forget to test the crash reporting capability of your app after you have proguarded it to make sure that you haven't accidentally obfuscated or removed something vital.

Do so by putting code in your application that causes an 'un-caught crash' which is outside of any try/catch blocks you have (temporarily of course.) Since ProGuard may remove 'un-needed code', make sure your crash logic is complex enough where it won't be stripped out by the ProGuard optimizer. For example:

// cause a crash...
String sCrashString = null;
Log.e("MyApp", sCrashString.toString() );

or

// cause a crash...
throw new NullPointerException();

If ACRA is working properly, you should see the results populated in your Backend/Mailbox. It should give you a stack trace with the file name and the line number where the crash happened. You can also check your logcat for messages with the ACRA tag to see if the test report was sent successfully.

Remember to remove your crash code when you are done testing!

Happy debugging.

Clone this wiki locally