flutter_tflite icon indicating copy to clipboard operation
flutter_tflite copied to clipboard

The plugin `tflite` uses a deprecated version of the Android embedding.

Open siddhant-debug opened this issue 3 years ago • 25 comments

The plugin tflite uses a deprecated version of the Android embedding. To avoid unexpected runtime failures, or future build failures, try to see if this plugin supports the Android V2 embedding. Otherwise, consider removing it since a future release of Flutter will remove these deprecated APIs. If you are plugin author, take a look at the docs for migrating the plugin to the V2 embedding: https://flutter.dev/go/android-plugin-migration.

siddhant-debug avatar Jan 16 '22 12:01 siddhant-debug

am also getting this same issue when i try to run the project ,its showing exaclty the same issue

rkohari avatar Jan 18 '22 02:01 rkohari

this is my log [✓] Flutter (Channel stable, 2.5.3, on macOS 12.1 21C52 darwin-arm, locale en-IN) • Flutter version 2.5.3 at /Applications/UserInstalled/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 18116933e7 (3 months ago), 2021-10-15 10:46:35 -0700 • Engine revision d3ea636dc5 • Dart version 2.14.4

[!] Android toolchain - develop for Android devices (Android SDK version 31.0.0) • Android SDK at /Users/hari/Library/Android/sdk ✗ cmdline-tools component is missing Run path/to/sdkmanager --install "cmdline-tools;latest" See https://developer.android.com/studio/command-line for more details. ✗ Android license status unknown. Run flutter doctor --android-licenses to accept the SDK licenses. See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.

[✓] Xcode - develop for iOS and macOS • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 13.2.1, Build version 13C100 • CocoaPods version 1.11.2

[✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2020.3) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)

[☠] IntelliJ IDEA Ultimate Edition (the doctor check crashed) ✗ Due to an error, the doctor check did not complete. If the error message below is not helpful, please let us know about this issue at https://github.com/flutter/flutter/issues. ✗ FormatException: Unexpected extension byte (at offset 5) • #0 _Utf8Decoder.convertSingle (dart:convert-patch/convert_patch.dart:1788:7) #1 Utf8Decoder.convert (dart:convert/utf.dart:318:42) #2 InputStream.readString (package:archive/src/util/input_stream.dart:199:30) #3 new ZipDirectory.read (package:archive/src/zip/zip_directory.dart:40:30) #4 ZipDecoder.decodeBuffer (package:archive/src/zip_decoder.dart:19:30) #5 ZipDecoder.decodeBytes (package:archive/src/zip_decoder.dart:14:12) #6 IntelliJPlugins._findPluginXml (package:flutter_tools/src/intellij/intellij.dart:130:44) #7 IntelliJPlugins._readPackageVersion (package:flutter_tools/src/intellij/intellij.dart:141:40) #8 IntelliJPlugins.validatePackage (package:flutter_tools/src/intellij/intellij.dart:63:35) #9 IntelliJValidator.validate (package:flutter_tools/src/intellij/intellij_validator.dart:103:15) #10 asyncGuard. (package:flutter_tools/src/base/async_guard.dart:111:32) #11 asyncGuard. (package:flutter_tools/src/base/async_guard.dart:109:18) #12 _rootRun (dart:async/zone.dart:1428:13) #13 _CustomZone.run (dart:async/zone.dart:1328:19) #14 _runZoned (dart:async/zone.dart:1863:10) #15 runZonedGuarded (dart:async/zone.dart:1851:12) #16 runZoned (dart:async/zone.dart:1782:12) #17 asyncGuard (package:flutter_tools/src/base/async_guard.dart:109:3) #18 Doctor.startValidatorTasks (package:flutter_tools/src/doctor.dart:200:9) #19 Doctor.diagnose (package:flutter_tools/src/doctor.dart:304:47) #20 DoctorCommand.runCommand (package:flutter_tools/src/commands/doctor.dart:50:47) #21 FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:1274:12) #22 FlutterCommand.run. (package:flutter_tools/src/runner/flutter_command.dart:1125:27) #23 AppContext.run. (package:flutter_tools/src/base/context.dart:150:19) #24 CommandRunner.runCommand (package:args/command_runner.dart:209:13) #25 FlutterCommandRunner.runCommand. (package:flutter_tools/src/runner/flutter_command_runner.dart:288:9) #26 AppContext.run. (package:flutter_tools/src/base/context.dart:150:19) #27 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:236:5) #28 run.. (package:flutter_tools/runner.dart:62:9) #29 AppContext.run. (package:flutter_tools/src/base/context.dart:150:19) #30 main (package:flutter_tools/executable.dart:92:3)

[✓] VS Code (version 1.62.3) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension can be installed from: 🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (2 available) • sdk gphone64 arm64 (mobile) • emulator-5554 • android-arm64 • Android 12 (API 31) (emulator) • Chrome (web) • chrome • web-javascript • Google Chrome 97.0.4692.71

rkohari avatar Jan 18 '22 02:01 rkohari

@siddhant-debug did u find any solution for this issue?

rkohari avatar Jan 18 '22 02:01 rkohari

@siddhant-debug did u find any solution for this issue?

No

siddhant-debug avatar Jan 18 '22 02:01 siddhant-debug

@siddhant-debug i fixed this issue,open andriod folder separatly,after it will download some necessary tflite files,it took around 5 mins i think.after close tha project and clear flutter ,now it will run .

rkohari avatar Jan 18 '22 07:01 rkohari

@siddhant-debug so the only solution is to wait for a new version that support Android V2?

TjayAmit avatar Jan 20 '22 14:01 TjayAmit

@rkohari can u explain ?

siddhant-debug avatar Jan 22 '22 15:01 siddhant-debug

@rkohari can u explain ?

@siddhant-debug Check this user's repo @rkohari "imagecapture" might help u. while writing this comment I still didn't try it myself, although am facing the same issue.

dasrocky avatar Feb 12 '22 08:02 dasrocky

@siddhant-debug so the only solution is to wait for a new version that support Android V2?

I found a solution from flutter team migration doc(my comment from reddit). After fixing the the migration issue, i even added a pull request Object_detection_flutter repo. Hope this helped.

dasrocky avatar Feb 26 '22 08:02 dasrocky

any one find the solution?

AjilAshok avatar Jun 11 '22 16:06 AjilAshok

any one find the solution?

I posted a solution for android embedding issue in Object_detection_flutter repo, which is an example of tflite_flutter package. The thing is, devs of tflite and tflite_flutter repo are not active (correct me if I am wrong). TBH it is a very simple solution just that u have to spend some time in reading the docs provided by flutter team for migration of android embedding. Either u can check the pull request file changes made and do the same or check the comment this on reddit.

Edit: Pull request, mentioned above in my message, doesn't work any more.

dasrocky avatar Jun 12 '22 09:06 dasrocky

Is it possible to apply this change in the main branch to generate a new version? Or is the project already advanced?

Daniek3d avatar Jul 14 '22 18:07 Daniek3d

any one find the solution?

I posted a solution for android embedding issue in Object_detection_flutter repo, which is an example of tflite_flutter package. The thing is, devs of tflite and tflite_flutter repo are not active (correct me if I am wrong). TBH it is a very simple solution just that u have to spend some time in reading the docs provided by flutter team for migration of android embedding. Either u can check the pull request file changes made and do the same or check the comment this on reddit.

i can't seem to find the file mentioned in the video for the java part instead i have a GeneratedPluginRestraint page in the java folder what should i do. Is there some other guidelines to follow for the same ? pls respond asap 🙇i have to turn in my project this weekend

Abel-Saji-George avatar Jul 18 '22 17:07 Abel-Saji-George

any one find the solution?

I posted a solution for android embedding issue in Object_detection_flutter repo, which is an example of tflite_flutter package. The thing is, devs of tflite and tflite_flutter repo are not active (correct me if I am wrong). TBH it is a very simple solution just that u have to spend some time in reading the docs provided by flutter team for migration of android embedding. Either u can check the pull request file changes made and do the same or check the comment this on reddit.

bro it's urgent pls i need ur help 🙇🙇🙇I'll even send over a quick 500 for fixing this issue on my project .I'm a student and im having my lab exam this week and kind of in an extremely shitty situation now

Abel-Saji-George avatar Jul 20 '22 17:07 Abel-Saji-George

Apologies for late reply, weirdly didnt receive any mail for above replies, checking mail found ur reply way down in mail. Thank you for offering, but I don't need one. I am happy to help but note that I am not that knowledgable in dart and flutter, I happen to refer documentation & some video that did the work for me. Also note that I worked on fixing android embedding v2 migration of tflite by amishgarg.tech (tflite_flutter). Again am happy to help.

dasrocky avatar Jul 21 '22 07:07 dasrocky

thank you bro for getting back to me I'll contact you today itself via discord.I desperately need your help on this matter at hand🙇My teacher was kind enough to give me a couple of days more time for solving the issue

On Thu, Jul 21, 2022 at 12:41 PM Rocky @.***> wrote:

Apologies for late reply, weirdly didnt receive any mail for above msg, checking mail found ur issue post way down in mail. Thank you for offering, but I don't need one. I am happy to help but note that I am not that knowledgable in dart and flutter, I happen to refer documentation & some video that did the work for me. Also note that I worked on fixing android embedding v2 migration of tflite by amishgarg.tech (tflite_flutter https://pub.dev/packages/tflite_flutter). Again am happy to help. Discord Id -> EliteArmedForce#2225

— Reply to this email directly, view it on GitHub https://github.com/shaqian/flutter_tflite/issues/239#issuecomment-1191126739, or unsubscribe https://github.com/notifications/unsubscribe-auth/AP2Y4EMAJLNEXC6QMOA5D33VVDZ2RANCNFSM5MCXA6GQ . You are receiving this because you commented.Message ID: @.***>

Abel-Saji-George avatar Jul 23 '22 13:07 Abel-Saji-George

I faced the same issue, I just followed the migration steps here and the project runs directly.

saadsb20 avatar Sep 01 '22 11:09 saadsb20

I faced the same issue, I just followed the migration steps here and the project runs directly.

@shaqian I think it could help migrate flutter_tflite Android embedding.

francisrod01 avatar Sep 07 '22 00:09 francisrod01

any one find the solution?

I posted a solution for android embedding issue in Object_detection_flutter repo, which is an example of tflite_flutter package. The thing is, devs of tflite and tflite_flutter repo are not active (correct me if I am wrong). TBH it is a very simple solution just that u have to spend some time in reading the docs provided by flutter team for migration of android embedding. Either u can check the pull request file changes made and do the same or check the comment this on reddit.

Edit: Pull request, mentioned above in my message, doesn't work any more.

sir can you do video tutorial about this sir

orbitsdev avatar Sep 24 '22 17:09 orbitsdev

the only thing which worked for me is not to use tflite dependency. Please try [tflite_flutter]

StephanieOgu avatar Mar 20 '23 09:03 StephanieOgu

@shaqian, you've got a great plugin however the Android embeddings migration is continuously making it unreliable to use. Kindly take a few hours of your busy schedule and do this migration. I think it is not that difficult if you follow the official documentation from flutter: https://docs.flutter.dev/release/breaking-changes/plugin-api-migration https://github.com/flutter/flutter/wiki/Upgrading-pre-1.12-Android-projects

fransay avatar Jun 14 '23 12:06 fransay

@fransay & everyone u dont have to worry about this package problems, as this flutter package is officially supported by TensorFlow themselves. Here is the repo: flutter_tflite

Edit: My bad, correction the tensorflow officially supports Amish Garg's tflite_flutter_plugin

dasrocky avatar Jun 18 '23 08:06 dasrocky

@fransay & everyone u dont have to worry about this package problems, as this flutter package is officially supported by TensorFlow themselves. Here is the repo: flutter_tflite

Edit: My bad, correction the tensorflow officially supports Amish Garg's tflite_flutter_plugin

@dasrocky I invite you and more folks to help me implement more use cases for Tensorflow official plugin.

I didn't receive a warm welcome when I asked them for some use cases. https://github.com/tensorflow/flutter-tflite/issues/105#issuecomment-1634816362

francisrod01 avatar Jul 27 '23 14:07 francisrod01

@francisrod01, Sure!, sounds good. Let me know when you are start. I'd love to contribute.

fransay avatar Jul 27 '23 14:07 fransay

@francisrod01, Sure!, sounds good. Let me know when you are start. I'd love to contribute.

I just opened a Discussion in the TensorFlow official support repo. https://github.com/tensorflow/flutter-tflite/discussions/116

francisrod01 avatar Jul 28 '23 12:07 francisrod01