abdelaziz-mahdy / pytorch_lite

flutter package to help run pytorch lite models classification and YoloV5 and YoloV8.
MIT License
51 stars 22 forks source link

Doesn't work with Flutter 3.16.0, build issue #62

Closed andynewman10 closed 10 months ago

andynewman10 commented 10 months ago

I get the following build error when using Flutter 3.16.0, released this week:

* What went wrong:
Execution failed for task ':app:mergeDebugNativeLibs'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.MergeNativeLibsTask$MergeNativeLibsTaskWorkAction
   > 2 files found with path 'lib/arm64-v8a/libc++_shared.so' from inputs:
      - C:\Users\andy\.gradle\caches\transforms-3\1c454ee693e9eb8e38682a0015c11502\transformed\jetified-arm64_v8a_debug-1.0.0-74d16627b940bb15e50891f82cad6c3e3465bd6d\arm64-v8a\libc++_shared.so
      - C:\Users\andy\.gradle\caches\transforms-3\8500a2e65b53023e66292bb8e4440e5f\transformed\jetified-pytorch_android-2.1.0\jni\arm64-v8a\libc++_shared.so
     If you are using jniLibs and CMake IMPORTED targets, see
     https://developer.android.com/r/tools/jniLibs-vs-imported-targets

Any idea how this error can be fixed?

abdelaziz-mahdy commented 10 months ago

I am not sure, but did a flutter clean help?

And if not let me know so I try to fix the problem

andynewman10 commented 10 months ago

I did do a flutter clean before running (actually, launching a debug session in VS code).

Other packages seem to have a similar issue: https://stackoverflow.com/questions/77493914/flutter-a-failure-occurred-while-executing-com-android-build-gradle-internal-t

andynewman10 commented 10 months ago

https://github.com/flutter/flutter/issues/138535

abdelaziz-mahdy commented 10 months ago

Thank you for sharing the link for the flutter issue,

https://github.com/flutter/flutter/issues/138535#issuecomment-1814624649

Looks like a good workaround to now, and I will leave the issue open Incase other people face it until a workaround can be implemented. Or this issue fixed by flutter team

andynewman10 commented 10 months ago

I confirm the workaround works.

Also, the behavior of pytorch_lite seems normal on Flutter 3.16.0, on both Android and iOS.