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

crash when useGpuDelegate is true in v2 #292

Open
chaoyifei opened this issue Apr 9, 2024 · 1 comment
Open

crash when useGpuDelegate is true in v2 #292

chaoyifei opened this issue Apr 9, 2024 · 1 comment

Comments

@chaoyifei
Copy link

crash when useGpuDelegate is true in v2,

await Tflite.loadModel(
        model: "assets/tflite/mobilenet_v1_1.0_224.tflite",
        labels: "assets/tflite/mobilenet_v1_1.0_224.txt",
        useGpuDelegate: true,
      );

like this:
Has anyone encountered it before?

E/AndroidRuntime(28327): Process: com.exmple.app, PID: 28327
E/AndroidRuntime(28327): java.lang.NoClassDefFoundError: Failed resolution of: Lorg/tensorflow/lite/gpu/GpuDelegateFactory$Options;
E/AndroidRuntime(28327): 	at org.tensorflow.lite.gpu.GpuDelegate.<init>(GpuDelegate.java:53)
E/AndroidRuntime(28327): 	at sq.flutter.tflite.TflitePlugin.loadModel(TflitePlugin.java:267)
E/AndroidRuntime(28327): 	at sq.flutter.tflite.TflitePlugin.onMethodCall(TflitePlugin.java:132)
E/AndroidRuntime(28327): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:267)
E/AndroidRuntime(28327): 	at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:292)
E/AndroidRuntime(28327): 	at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:319)
E/AndroidRuntime(28327): 	at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
E/AndroidRuntime(28327): 	at android.os.Handler.handleCallback(Handler.java:1013)
E/AndroidRuntime(28327): 	at android.os.Handler.dispatchMessage(Handler.java:101)
E/AndroidRuntime(28327): 	at android.os.Looper.loopOnce(Looper.java:226)
E/AndroidRuntime(28327): 	at android.os.Looper.loop(Looper.java:328)
E/AndroidRuntime(28327): 	at android.app.ActivityThread.main(ActivityThread.java:9176)
E/AndroidRuntime(28327): 	at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(28327): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:586)
E/AndroidRuntime(28327): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
E/AndroidRuntime(28327): Caused by: java.lang.ClassNotFoundException: Didn't find class "org.tensorflow.lite.gpu.GpuDelegateFactory$Options" on path: DexPathList[[zip file "/data/app/~~0xnbUkoK8PZg7fjquy-iMQ==/com.exmple.app-4zfN4OvmP50OXdmzWQE22A==/base.apk"],nativeLibraryDirectories=[/data/app/~~0xnbUkoK8PZg7fjquy-iMQ==/com.exmple.app-4zfN4OvmP50OXdmzWQE22A==/lib/arm64, /data/app/~~0xnbUkoK8PZg7fjquy-iMQ==/com.exmple.app-4zfN4OvmP50OXdmzWQE22A==/base.apk!/lib/arm64-v8a, /system/lib64, /system_ext/lib64]]
E/AndroidRuntime(28327): 	at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:259)
E/AndroidRuntime(28327): 	at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
E/AndroidRuntime(28327): 	at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
E/AndroidRuntime(28327): 	... 15 more
I/Process (28327): Sending signal. PID: 28327 SIG: 9
Lost connection to device.
@chaoyifei
Copy link
Author

to solve this problem ,
can add this to build .gradle

implementation 'org.tensorflow:tensorflow-lite-gpu-api:+'

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

No branches or pull requests

1 participant