klarna / klarna-mobile-sdk

Klarna Mobile SDK for iOS
https://docs.klarna.com/mobile-sdk/ios/
Apache License 2.0
29 stars 12 forks source link

Adding Klarna SDK to our App increases our APK (downloadable) size by 5MB #136

Closed tanmayyy closed 2 years ago

tanmayyy commented 2 years ago

Describe the bug After adding the Klarna In App Android SDK to our app, our App (downloadable) size increased by over 5 MB and overall app size increased by 10 MB (uncompressed).

To Reproduce Build a release build with Klarna SDK. Analyze the APK using APK Analyzer.

Expected behavior To not increase our App size so significantly.

Screenshots

Screenshot 2022-03-29 at 17 42 45

Device and version:

Merchant Name Vestiaire Collective

Impact Level It increased our App size drastically which can have a negative impact on our app propagation.

Additional context I did some digging on why the apk size increases so drastically. The main contributor is the Tensorflow lite dependency. (org.tensorflow:tensorflow-lite:1.15.0) It adds a bunch binaries that contribute directly to the increase in apk size. (libtensorflowlite_jni.so files)

Screenshot 2022-03-21 at 21 52 45

It also adds a resource file which is over 1 MB - FJ.tflite I tried excluding the dependency but then the In App SDK stopped working.

NMGuner commented 2 years ago

Hi @tanmayyy, the default(full) variant of the SDK includes these resources for the card scanning feature. Alternatively, if you don't want that feature and prefer a smaller package, you can use implementation 'com.klarna.mobile:sdk-basic:2.1.6' instead of implementation 'com.klarna.mobile:sdk:2.1.6'.

I am closing this issue now, but don't hesitate to contact us if you notice this or any other problem.

tanmayyy commented 2 years ago

Thanks a lot @NMGuner for your response, I will try it out