Description
While building Unity may fail the build with the error: Error: More than one file was found with OS independent path 'lib/arm64-v8a/libc++_shared.so'.
Cause
This is caused by Snapdragon Spaces and another plugin both dynamically linking to the libc++shared.so library.
Affected Versions of Snapdragon Spaces SDK
This bug has been fixed with Snapdragon Spaces 0.19.1.
Previous versions are still affected, and it is recommended to update the SDK when encountering this error.
Workaround
For Unity resolve this by:
- Delete either one of the libc++shared files. It is recommended to delete the .so file of the other plugin over the Snapdragon Spaces one. The libc++_shared of Snapdragon Spaces is located in the package at UnityPackage\com.qualcomm.snapdragon.spaces-[spaces version].tgz\com.qualcomm.snapdragon.spaces-0.16.1.tgz\package\Runtime\Core\Android\libopenxr_loader.aar\jni\arm64-v8a\ within the libopenxr_loader.aar file.
- Modify the Custom Launcher Gradle Template:
- Enable Custom Launcher Gradle Template the Project Settings.
- This generates a launcherTemplate.gradle file under [Project Folder] > Plugins > Android.
- Add the lines to launcherTemplate.gradle:
packagingOptions {
pickFirst("lib/arm64-v8a/libc++_shared.so")
}
Note that, while this will usually fix the issue, there can be potential version incompatibilities when the libc++shared.so version is different between the Snapdragon Spaces and other plugin.
Upcoming versions of Snapdragon Spaces will link this library statically to avoid conflicts with plugins by 3rd-parties.