2017-06-30 109 views
4

當我嘗試將Google VR SDK('GVRSDK')作爲Podfile依賴項添加時,我遇到了React Native的問題,並且它很容易複製。React Native與Google VR SDK不兼容

步驟:

  1. 創建一個新的空白陣營本地項目。使用react-native run-ios運行它以確保其正常工作。
  2. cd ios
  3. pod init
  4. 添加pod 'GVRSDK'到Podfile,執行pod update
  5. cd ..
  6. react-native run-ios

項目開車撞以下錯誤:

duplicate symbol __ZN3fLI9FLAGS_novE in: 
/foo/ios/Pods/GVRSDK/Libraries/libGVRSDK.a(vlog_is_on.o) 
/foo/ios/build/Build/Products/Debug-iphonesimulator/libReact.a(vlog_is_on.o) 
duplicate symbol __ZN3fLI7FLAGS_vE in: 
/foo/ios/Pods/GVRSDK/Libraries/libGVRSDK.a(vlog_is_on.o) 
/foo/ios/build/Build/Products/Debug-iphonesimulator/libReact.a(vlog_is_on.o) 
duplicate symbol __ZN6google13RemoveLogSinkEPNS_7LogSinkE in: 
/foo/ios/build/Build/Products/Debug-iphonesimulator/libReact.a(logging.o) 
/foo/ios/Pods/GVRSDK/Libraries/libGVRSDK.a(logging.o) 
duplicate symbol __ZN6google10AddLogSinkEPNS_7LogSinkE in: 
/foo/ios/build/Build/Products/Debug-iphonesimulator/libReact.a(logging.o) 
    /foo/ios/Pods/GVRSDK/Libraries/libGVRSDK.a(logging.o) 
ld: 4 duplicate symbols for architecture x86_64 
clang: error: linker command failed with exit code 1 (use -v to see invocation) 



** BUILD FAILED ** 


The following build commands failed: 

Ld build/Build/Products/Debug-iphonesimulator/foo.app/foo normal x86_64 
(1 failure) 
+0

降級到反應原生0.44.1(從0.45.1開始)似乎解決了這個問題。 –

+0

同樣適用於我。降級(從0.45.1到0.44.3)將其固定。 – YossiF

回答

2

您可以通過刪除libGVRSDK.a中的重複符號來解決此問題。 lipoar命令用於反彙編幾個體系結構中的庫文件並將它們重新歸檔到另一個文件中。

我所做的shell腳本如下:

pod_post_install.sh

#!/bin/bash 

cd ./Pods/GVRSDK/Libraries/ 
lipo -info libGVRSDK.a 

# Divide to each platform 
lipo -thin armv7 libGVRSDK.a -output libGVRSDK_armv7 
lipo -thin i386 libGVRSDK.a -output libGVRSDK_i386 
lipo -thin x86_64 libGVRSDK.a -output libGVRSDK_x86_64 
lipo -thin arm64 libGVRSDK.a -output libGVRSDK_arm64 

# Delete duplicate file 
chmod 777 libGVRSDK_armv7 
chmod 777 libGVRSDK_i386 
chmod 777 libGVRSDK_x86_64 
chmod 777 libGVRSDK_arm64 

ar -dv libGVRSDK_armv7 vlog_is_on.o 
ar -dv libGVRSDK_i386 vlog_is_on.o 
ar -dv libGVRSDK_x86_64 vlog_is_on.o 
ar -dv libGVRSDK_arm64 vlog_is_on.o 

# rm libGVRSDK.a 
lipo -create libGVRSDK_armv7 libGVRSDK_i386 libGVRSDK_x86_64 libGVRSDK_arm64 -output libGVRSDK.a 

# Delete media 
rm libGVRSDK_armv7 
rm libGVRSDK_i386 
rm libGVRSDK_x86_64 
rm libGVRSDK_arm64 

cd ../../../ 

如果正在運行的每吊艙安裝在調用此腳本,可以更加有用。

Podfile

post_install do |installer| 
    system(". ./pod_post_install.sh") 
end 

我相信它幫助。