2

Everything in my debug APK works just fine. However, when I export my APK and install it, everything works fine until I make a call to a referenced library.

E/AndroidRuntime(32571):    at com.znood.znoodapp.ShowResultsActivity.a (Unknown Source)

I am using ProGuard.

My libraries are in the libs directory and are added to build path.

Any pointers are highly appreciated =)

Abdo
  • 13,549
  • 10
  • 79
  • 98

2 Answers2

2

The problem was with the Google Gson library. Proguard converts class names into obfuscated ones rendering json conversion buggy.

In order to solve this problem, make sure to have the following in your proguard-project.txt

# the classes that you use for Gson conversion
-keep class com.yourapp.objects.** { *; }

# without this line, I was having ClassCastException
-keepattributes Signature, *Annotation*

I hope this helps someone =)

Abdo
  • 13,549
  • 10
  • 79
  • 98
1

If you haven't defined your libraries in proguard-project.txt then you can add like this

-libraryjars /libs/smack.jar
-libraryjars /libs/libphonenumber-5.0v1.5.jar

Android obfuscate app using proguard keeps obfuscating library jars - or is it?

Community
  • 1
  • 1
Juned
  • 6,290
  • 7
  • 45
  • 93
  • I followed the instructions in that post; still getting crashes. I used dex2jar to make sure the code in the jars is there. It is... I did not have the jars before, so your suggestion might be taking me somewhere, thanks :-) – Abdo Oct 31 '12 at 13:02
  • Alternatively you can sign your apk using eclipse IDE. [check](http://techdroid.kbeanie.com/2010/02/sign-your-android-applications-for.html) Export wizard of Eclipse – Juned Oct 31 '12 at 13:20
  • This is how I'm signing them :-) – Abdo Oct 31 '12 at 14:04
  • Thanks for your help, @juned :-) The problem was with classes used by Gson being renamed =) – Abdo Oct 31 '12 at 16:26
  • ohhh great,if your problem is solved then you can answer to your own question and mark as an answer :) – Juned Nov 01 '12 at 05:14
  • I have answered =) I have to wait for two days before I could mark it as an answer :-) Thanks so much for your help! – Abdo Nov 01 '12 at 10:41