lyft / scissors

✂ Android image cropping library
https://eng.lyft.com/scissors-an-image-cropping-library-for-android-a56369154a19
Apache License 2.0
1.84k stars 235 forks source link

Proguard Setup #14

Closed rohanmahale closed 8 years ago

rohanmahale commented 8 years ago

@eveliotc .

The debug version of my app works fine. I created a release build for my app, and on selecting a picture to be cropped the app crashes stating the following.

java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=10001, result=-1,     data=Intent { dat=content://media/external/images/media/9279 }} to activity    {com.prism.prismapp/com.prism.prismapp.CropImageActivity_}: java.lang.IllegalStateException:    You must provide a BitmapLoader.
at android.app.ActivityThread.deliverResults(ActivityThread.java:3367)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:3410)
at android.app.ActivityThread.access$1300(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1260)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5113)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.IllegalStateException: You must provide a BitmapLoader.
at com.lyft.android.scissors.CropViewExtensions.resolveBitmapLoader(Unknown Source)
at com.lyft.android.scissors.CropViewExtensions$LoadRequest.load(Unknown Source)
at com.lyft.android.scissors.CropView$Extensions.load(Unknown Source)
at com.prism.prismapp.g.onActivityResult(Unknown Source)
at android.app.Activity.dispatchActivityResult(Activity.java:5440)
at android.app.ActivityThread.deliverResults(ActivityThread.java:3363)

Can we have an updated read me with the proguard setup?

eveliotc commented 8 years ago

@rohanmahale your BitmapLoader class are getting obfuscated, can you confirm this works for you?:

-keepnames class com.bumptech.glide.Glide
-keepnames class com.squareup.picasso.Picasso
rohanmahale commented 8 years ago

@eveliotc Are these the only lines I need to add to proguard?

I tried it and I get an error

Error:proguard.ParseException: Unexpected keyword 'com.bumptech.glide.Glide' in line 110 of file '/Users/rohanmahale/AndroidStudioProjects/Prism/app/proguard-rules.pro'

@eveliotc - Any idea what I'm missing here?

EDIT :

I added this line in proguard which seems to have made it work

-keep class com.bumptech.glide.*{ ; }

eveliotc commented 8 years ago

@rohanmahale you also need class keyword before classname, I've updated snippet, please let me know

rohanmahale commented 8 years ago

@eveliotc Works perfectly now. Thanks! Could we have a proguard setup section in the README?

eveliotc commented 8 years ago

@rohanmahale I added those rules on #17 once it's deployed build process should pick up scissors' proguard rules :)

rohanmahale commented 8 years ago

:+1: