-
Notifications
You must be signed in to change notification settings - Fork 755
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Increased App Size #26
Comments
@lks-nbg Thanks for pointing it out. I'll add this in the docs. |
Hi @lks-nbg |
@adriancsbna libclassifier_jni |
Hello @bharat-biradar. I have applied it but the size of the App has not decreased. |
Yep, this did work it reduced my app-release.apk size from 323MB to 86MB but can I reduce it even more? because I only want to use OCR (image text reader). |
@adriancsbna Could give me the android part of |
@MalayAgrawal Maybe it can be reduced. I looked at the size of our example app using devtools and I found this. |
Hi @bharat-biradar here you have it I managed to reduce the size by adding ignoreAssetsPattern '!mlkit_pose:' but I'm sure I can add more to lower the size further. Do you know what options there are to add there? buildTypes {
|
OCR is working great and app size reduced to 30MB approx |
@adriancsbna Try adding models along with mlkit_pose |
since I'm using this package for scanning barcode to get results which unnecessary lib and models i need to excluded? |
@TusharPatel18 I think you should comment out common pipeline and libbarh... I'm not sure I'm guessing as it looks similar to barcode, in in ignore assets add mlkit_pse and image label. Scroll up to see this implementation |
One of my apps only uses it for barcode scanning, the following is how I have it configured: Click to expandpackagingOptions {
exclude 'lib/**/libtranslate_jni.so'
exclude 'lib/**/libdigitalink.so'
exclude 'lib/**/libxeno_native.so'
exclude 'lib/**/libmlkitcommonpipeline.so'
// exclude 'lib/**/libbarhopper_v2.so' → required for barcode detection
exclude 'lib/**/libclassifier_jni.so'
exclude 'lib/**/libface_detector_v2_jni.so'
exclude 'lib/**/libtensorflowlite_jni.so'
exclude 'lib/**/liblanguage_id_jni.so'
} |
I'm not super familiar with the iOS side of things, is there an equivalent solution for iOS? Or is it necessary at all? |
not for now, 3rd party dependencies are managed in Xcode using Cocoapods or Swift Package Manager, ours uses Cocoapods. Eventually I will work on a way to only add the scanners you need, but for now in iOS the bundle comes with all. |
I am working on an app to use face detection only. Is there any more stuff I can add to the My current release app size is 58MB. The app is basically the example app from this repo with everything removed except the face recognition parts. This is my current
|
@ashwinkey04 Analyze the app size through dev tools and look at the instances under |
Thanks a lot @bharat-biradar. I removed a few models without breaking the app and managed to bring the size down to 35 MB for the bulk release apk and 23 MB for v8a. Yet to try and remove more assets as I am expected to make something less than 10 MB. Thanks for the time :) |
@adriancsbna Thanks. how to reduce app size in IOS? |
I want to use Japanese Text recognition only. What should I do? |
@ashwinkey04 What did you exclude for only facedetection ? |
I'm only using
But the size is still huge.. especially the What else do I exclude ? |
@wazini-john Try excluding |
How can i remove hobbes.tflite, I also need only for face detection |
@deepaklohmod6789 Mention |
I did this but still the size is 86.6 mb |
@deepaklohmod6789 run |
@cngeru thanks a lot, it worked : ) |
@swissonid, @SatishKumarRaizada: collaboration is always welcome, feel free to send a PR with what you are proposing |
@swissonid I am checking if we can work with unbundled models instead of model bundels. If it works I think size won't be an issue then. |
@fbernaly I spend yesterday on smaller lib (google_ml_vision )because that the one we use right now. Anyway, the problem is the same. And with a "simple" PR it isn't done. If the vision of this Plugin / Lib is to split it into smaller pieces, that will a fundamental change in the architecture. And gonna take its time. |
Thanks @swissonid : I will look at it. Splitting this plugin into multiple packages will take some time. First we need to have parity between iOS and Android, because right now we have some features implemented in Android but not in iOS. |
Any ideas to reduce AppSize in iOS. I am only using OCR and app size after including this plugin increases by ~50MB. |
How we reduce app size in IOS ? |
@Surajsahani28 I couldn’t find a way to reduce the app size with this plugin..I ended using the cloud ocr .. |
any update? |
If it's not too much to ask for, I would love if anybody can list what refer to each of the ML Kit assets, or share a link of any docs that talk about that. |
For anybody looking to seriously reduce the size, I would suggest going to the plugin implementation.
|
If anyone is interested in barcode / QR scanning only, you can check out this fork. Please note: it's not reflective of how you should do native programming properly, but it works with a previous barcode scanner implementation in Flutter. |
Looks like the most fool-proof way to decrease size is to
@bharat-biradar do you have a suggestion on how to get this behavior implemented upstream? |
@panmari A way to use from your fork would be to
I have made an example in the barcode_only branch. Hope this helps. |
@bharat-biradar Thank you for the idea. I created a fork for
For the iOS side: wouldn't conditional compilation help ? That is the same as deleting the not needed files. But then we still need a solution for the CocoaPods podspec so that only the necessary dependencies are pulled by CocoaPods. |
@nachtmaar Sorry but I don't know about Ios side of things but please try and if it works, please mention it here. |
Thanks @nachtmaar for the effort of creating the fork, that was exactly what I was looking for. |
i only use pose detection and my aaptOptions is `aaptOptions { }`
but it's size still 129 mb please help me to reduce the size. |
We released a new version of google_ml_kit in which we have split all the plugins in multiple plugins to avoid removing the models for API you are not using, go to our readme and start using the new plugin you need. More details here: https://github.com/bharat-biradar/Google-Ml-Kit-plugin/tree/master/packages/google_ml_kit |
Hi, I am using: |
After implementing google_ml_kit, the app size is increased by ~85 MB in debug mode and ~44 MB in release mode. I investigated this with the app size tool and found that all models/resources are always included, even if they are not used. So it would be great to be able to configure which resources are used and and which can be excluded.
The firebase_ml_vision plugin had the same issue (firebase/flutterfire#4767) and I was able to adapt the workaround of excluding unused resources to google_ml_kit and wanted to share it. In my case I am currently only using the language detection feature therefore I don't need pose detection, etc.
The workaround for Android looks like that and increases the app size by less than 3 MB:
Since a workaround does exist, this is not a pressing issue, but I think many developers would appreciate some sort of configuration option :)
The text was updated successfully, but these errors were encountered: