Skip to content
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

feat: Support more image formats on Android #634

Merged

Conversation

ueman
Copy link
Contributor

@ueman ueman commented May 26, 2024

Instead of hardcoding a specific format, we're now properly using the correct format as specified on the Dart side.

In case an invalid image format was used, this throws the following exception:

PlatformException(error, null, null, java.lang.IllegalArgumentException
	at com.google.android.gms.common.internal.Preconditions.checkArgument(com.google.android.gms:play-services-basement@@18.3.0:1)
	at com.google.mlkit.vision.common.InputImage.<init>(com.google.mlkit:vision-common@@17.3.0:7)
	at com.google.mlkit.vision.common.InputImage.fromByteArray(com.google.mlkit:vision-common@@17.3.0:2)
	at com.google_mlkit_commons.InputImageConverter.getInputImageFromData(InputImageConverter.java:36)
	at com.google_mlkit_barcode_scanning.BarcodeScanner.handleDetection(BarcodeScanner.java:70)
	at com.google_mlkit_barcode_scanning.BarcodeScanner.onMethodCall(BarcodeScanner.java:41)
	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:267)
	at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:292)
	at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:319)
	at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
	at android.os.Handler.handleCallback(Handler.java:938)
	at android.os.Handler.dispatchMessage(Handler.java:99)
	at android.os.Looper.loopOnce(Looper.java:210)
	at android.os.Looper.loop(Looper.java:299)
	at android.app.ActivityThread.main(ActivityThread.java:8168)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:556)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1037)
)

Copy link
Collaborator

@bensonarafat bensonarafat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ueman
thanks for your contribution.
all looks good
Can you make the semantic PR pass ?

@ueman ueman changed the title Support more image formats on Android feat: Support more image formats on Android May 27, 2024
@fbernaly
Copy link
Collaborator

@ueman : Thanks for your contribution, could you add a similar comment you added for Android but for iOS.

Also, bump the version to 0.7.2

https://github.com/flutter-ml/google_ml_kit_flutter/blob/develop/packages/google_mlkit_commons/pubspec.yaml#L3

And update CHANGELOG:

https://github.com/flutter-ml/google_ml_kit_flutter/blob/develop/packages/google_mlkit_commons/CHANGELOG.md

@fbernaly fbernaly merged commit e8338de into flutter-ml:develop May 30, 2024
2 checks passed
@fbernaly
Copy link
Collaborator

@ueman : it has been merged into develop branch, I will test with example app and release the new version ASAP

@fbernaly
Copy link
Collaborator

Thanks for the contribution

@FantaMagier
Copy link

Hey any news for the production? I think this would be huge

@ueman
Copy link
Contributor Author

ueman commented Sep 26, 2024

This was already released, see https://pub.dev/packages/google_mlkit_commons/changelog

@ueman ueman deleted the support-more-image-formats-on-android branch September 26, 2024 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants