asus4 / tf-lite-unity-sample

TensorFlow Lite Samples on Unity
870 stars 254 forks source link

More than one file was found with OS independent path 'lib/arm64-v8a/libtensorflowlite_jni.so'. #280

Closed pot2mayo closed 1 year ago

pot2mayo commented 1 year ago

Environment:

Describe the bug While building on Android I get the following error:

More than one file was found with OS independent path 'lib/arm64-v8a/libtensorflowlite_jni.so'.

However the file mentioned is nowhere to be found in the project, the plugin sources or the build intermediate files.

Here is the full error message:


* What went wrong:
Execution failed for task ':launcher:mergeReleaseNativeLibs'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
   > More than one file was found with OS independent path 'lib/arm64-v8a/libtensorflowlite_jni.so'. If you are using jniLibs and CMake IMPORTED targets, see https://developer.android.com/studio/preview/features#automatic_packaging_of_prebuilt_dependencies_used_by_cmake

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 12s
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
]
stdout[
Starting a Gradle Daemon, 1 incompatible and 2 stopped Daemons could not be reused, use --status for details

Any idea what could cause this?

asus4 commented 1 year ago

Hi @pot2mayo libtensorflowlite_jin.so should be inside of the tensorflow-lite.arr file - it's a zip file, you will find at the path Packages/com.github.asus4.tflite/Plugins/Android/tensorflow-lite.aar.

tensorflow-lite.aar
├── AndroidManifest.xml
├── LICENSE
├── R.txt
├── classes.jar
├── headers
│   └── tensorflow
│       └── lite
│           ├── builtin_ops.h
│           ├── c
│           │   ├── c_api.h
│           │   ├── c_api_experimental.h
│           │   ├── c_api_types.h
│           │   └── common.h
│           └── delegates
│               └── nnapi
│                   └── nnapi_delegate_c_api.h
├── jni
│   ├── arm64-v8a
│   │   └── libtensorflowlite_jni.so
│   ├── armeabi-v7a
│   │   └── libtensorflowlite_jni.so
│   └── x86_64
│       └── libtensorflowlite_jni.so
├── proguard.txt
└── res

If the file size is small, please confirm you installed Git-LFS. The file size should be around 4.6mb. For more detail https://github.com/asus4/tf-lite-unity-sample/issues/199#issuecomment-1059016383

pot2mayo commented 1 year ago

@asus4 Thank you for the quick reply.

I could find the aar archive and it is around the size you mentioned and the .so files are indeed in it.

Please note that I installed the package using UPM as described in the readme. I only included the com.github.asus4.tflite package since I don't think I need the others to simply run an tflite model inference.

Unfortunately that did not really give me any clue on why the gradle build process fails and raises the error I mentioned in my original message.

Could this be due to the fact that libtensorflowlite_jni.so is included in both tensorflow-lite.aar and tensorflow-lite-gpu.aar, thus creating the duplicate file error I mentioned?

asus4 commented 1 year ago

I thought the tensorflow-lite.aar library was included in the core NPM package. let me check it later

pot2mayo commented 1 year ago

@asus4 Indeed it is included in the UPM package. Both tensorflow-lite.aar and tensorflow-lite-gpu.aar are included to be exact. My error is not a missing lib actually but the opposite, gradle complains that the .so library is duplicated.

More than one file was found with OS independent path 'lib/arm64-v8a/libtensorflowlite_jni.so'.

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.