Unity iOS构建错误:使用Firebase Unity SDK + Google VR SDK for Unity时出现重复符号 [英] Unity iOS build error: duplicate symbols when using Firebase Unity SDK + Google VR SDK for Unity
问题描述
我正在使用 Google VR SDK for Unity 和 FirebaseMessaging.unitypackage $>来开发 Unity项目 c $ c $>来自 Firebase SDK for Unity 。
Google SDK的这种组合引发了 code>错误,当我尝试为iOS构建。
最小,完整和可验证的例子重现错误:
要求:
$ b
这是一个错误GVR sdk。问题是,GVR被发布,包括传递依赖,其中一些在谷歌(或别处)的其他SDK也依赖于,如firebase。由于Unity没有任何软件包管理,我们已经推出了自己的软件: -jar-resolverrel =nofollow noreferrer> https://github.com/googlesamples/unity-jar-resolver
然而GVR sdk isn还没有使用它来包含它的传递依赖,所以我们得到的冲突。
我正在做一个修复,使IOSResolver上面,在GVR中检测到这一点,剥离不应包含的对象。
同时,您可以使用以下方法自行去除冗余对象:
- 在资产/插件/ iOS / libgvrunity.a中找到libgvrunity.a
在包含以下内容:
set -ex
lipo libgvrunity.a -thin armv7 -output libgvrunity-armv7。 a
lipo libgvrunity.a -thin arm64 -output libgvrunity-arm64.a
ar -t libgvrunity-armv7.a | grep'GTMLogger \ | GTMSession'| xargs ar -dv libgvrunity-armv7.a
ar -t libgvrunity-arm64.a | grep'GTMLogger \ | GTMSession'| xargs ar -dv libgvrunity-arm64.a
lipo libgvrunity.a -replace armv7 libgvrunity-armv7.a -replace arm64 libgvrunity-arm64.a -output libgvrunity-fat.a
rm libgvrunity-armv7.a libgvrunity-arm64.a
mkdir -p备份
mv libgvrunity.a备份
mv libgvrunity-fat.a libgvrunity.a $
再次建立并运行Unity。
I'm working on an Unity project where I'm using the Google VR SDK for Unity and the FirebaseMessaging.unitypackage
from the Firebase SDK for Unity.
This combination of Google SDK's throws a duplicate symbols
error when I try to build for iOS.
Minimal, Complete, and Verifiable example to reproduce the error:
Requirements:
- iOS device (version 7.0 or later)
- Computer with macOS
- Latest Unity version (5.5.2f1)
- Latest Xcode version (8.2.1)
Steps:
- Download the Google VR SDK for Unity (v1.20).
- Download the Firebase SDK for Unity (v3.0.0).
- Unzip the Firebase SDK for Unity.
- Open Unity and create a new project.
- Go to File > Build Settings... , select iOS and click on Switch Platform.
- Open Player Settings... and set a Bundle Identifier.
- Go to Assets > Import Package > Custom package... , select the
GoogleVRForUnity.unitypackage
and import all except the Demos folder. - A Pop-Up window will appear. Select I Made a Backup, Go Ahead!.
- Another Pop-Up window will appear. Select Import Package and Import all.
- Go to Assets > Import Package > Custom package... , select the unzipped
FirebaseMessaging.unitypackage
and import all of it. - File > Save project
- Connect the iOS device to the computer.
- File > Build & Run
- The Xcode build will fail because the project needs a signing with a team. Set it in your Xcode project to a valid one.
- Press the Xcode play button to build & run the project on your connected iOS device.
The project build on Xcode will end with the following error:
25 duplicate symbols for architecture arm64
The architecture changes depending of the connected iOS device, but the error is the same.
- Is there something that we can do?
- Is it an error that must be resolved by Google?
This is a bug in the GVR sdk. The problem is that GVR was released including the transitive dependencies, some of which other SDKs at google (or elsewhere) depend on as well, such as firebase. Since Unity doesn't have any package management for this, we've rolled our own:
https://github.com/googlesamples/unity-jar-resolver
However GVR sdk isn't yet using this to include its transitive dependencies and so we get the conflicts.
I'm working on a fix that makes the IOSResolver above, detect this in GVR and strip the objects that should not be included.
In the meantime, here's a work-around you can use to strip the redundant objects yourself:
- Locate: libgvrunity.a in Assets/Plugins/iOS/libgvrunity.a
Create a shell script in the folder with the following contents:
set -ex lipo libgvrunity.a -thin armv7 -output libgvrunity-armv7.a lipo libgvrunity.a -thin arm64 -output libgvrunity-arm64.a ar -t libgvrunity-armv7.a | grep 'GTMLogger\|GTMSession' | xargs ar -dv libgvrunity-armv7.a ar -t libgvrunity-arm64.a | grep 'GTMLogger\|GTMSession' | xargs ar -dv libgvrunity-arm64.a lipo libgvrunity.a -replace armv7 libgvrunity-armv7.a -replace arm64 libgvrunity-arm64.a -output libgvrunity-fat.a rm libgvrunity-armv7.a libgvrunity-arm64.a mkdir -p backup mv libgvrunity.a backup mv libgvrunity-fat.a libgvrunity.a
Build and run from Unity again.
这篇关于Unity iOS构建错误:使用Firebase Unity SDK + Google VR SDK for Unity时出现重复符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!