azihsoyn / flutter_mlkit

A Flutter plugin to use the Firebase ML Kit.
MIT License
392 stars 91 forks source link

Got an error when using a custom model loaded in the cloud and also locally #95

Closed ArielFerreiro closed 4 years ago

ArielFerreiro commented 4 years ago

Hi I followed the steps in your notes to integrate a custom model with a flutter app and I am getting this error:

E/MethodChannel#plugins.flutter.io/mlkit(29273): Failed to handle method call E/MethodChannel#plugins.flutter.io/mlkit(29273): java.lang.IndexOutOfBoundsException: off=0, len=602112 out of bounds (size=150528) E/MethodChannel#plugins.flutter.io/mlkit(29273): at java.nio.Buffer.checkBounds(Buffer.java:587) E/MethodChannel#plugins.flutter.io/mlkit(29273): at java.nio.DirectByteBuffer.put(DirectByteBuffer.java:292) E/MethodChannel#plugins.flutter.io/mlkit(29273): at com.azihsoyn.flutter.mlkit.MlkitPlugin.onMethodCall(MlkitPlugin.java:347) E/MethodChannel#plugins.flutter.io/mlkit(29273): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:231) E/MethodChannel#plugins.flutter.io/mlkit(29273): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:93) E/MethodChannel#plugins.flutter.io/mlkit(29273): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:642) E/MethodChannel#plugins.flutter.io/mlkit(29273): at android.os.MessageQueue.nativePollOnce(Native Method) E/MethodChannel#plugins.flutter.io/mlkit(29273): at android.os.MessageQueue.next(MessageQueue.java:336) E/MethodChannel#plugins.flutter.io/mlkit(29273): at android.os.Looper.loop(Looper.java:197) E/MethodChannel#plugins.flutter.io/mlkit(29273): at android.app.ActivityThread.main(ActivityThread.java:7811) E/MethodChannel#plugins.flutter.io/mlkit(29273): at java.lang.reflect.Method.invoke(Native Method) E/MethodChannel#plugins.flutter.io/mlkit(29273): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) E/MethodChannel#plugins.flutter.io/mlkit(29273): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1076)

ArielFerreiro commented 4 years ago

I solved the issue using BYTE instead of FLOAT32