flutter_stripe icon indicating copy to clipboard operation
flutter_stripe copied to clipboard

Reduce package size for Android builds

Open 0ttik opened this issue 3 years ago • 4 comments

Is your feature request related to a problem? (please describe) Too big size of the package for Android build: after adding flutter_stripe to a new project, it increases size of a resulting apk file by about 7.9MB for the release build (flutter build apk).

Describe the solution you'd like Check for the possibilities to shrink package size for Android builds.

0ttik avatar Jan 23 '22 15:01 0ttik

Hi there,

We already use the minimum amount of dependencies to make it work, which is the stripe android package. I suggest to have a look if proguard can help you and consult on the stripe android repository for further questions.

jonasbark avatar Jan 23 '22 16:01 jonasbark

@jonasbark, thank you!

For documentation purposes, I'll leave the following link to the stripe-android repo. Seems that size can be reduced using proguard settings.

https://github.com/stripe/stripe-android/issues/4483

0ttik avatar Jan 23 '22 16:01 0ttik

@jonasbark, I would also consider adding this to the documentation, since it can be critical for some users. What do you think?

0ttik avatar Jan 23 '22 16:01 0ttik

yes that is very useful I will reopen it and add it to the docs project

remonh87 avatar Jan 26 '22 10:01 remonh87

The codebase is already shrunk by default using R8 see docs.

While the comment above suggest the app will be reduced if not using Payment Sheet, in this package the bindings make use of these apis. So even if Payment Sheet is not used in the dart side, it is used in the native side, and therefore will not be removed during minification.

We could separate the PaymentSheet into a separate package, but right now is not worth the development effort to do it and mantain it. Plus the inconvenience for all developers to migrate from a breaking change like that

jamesblasco avatar Dec 10 '22 15:12 jamesblasco