Quickstart for Google Cardboard for Unity

https://developers.google.com/cardboard/develop/unity/quickstart

Unity ver.2020.3.38

Mac ver.12.6

Xcode ver.14.0.1

Google Cardboard のデモを iOS 用にビルドしたら以下のエラー

Showing Recent Messages
Undefined symbol: google::protobuf::MessageLite::ParseFromArray(void const*, int)
Undefined symbol: google::protobuf::RepeatedField<float>::InternalSwap(google::protobuf::RepeatedField<float>*)
Undefined symbol: google::protobuf::RepeatedField<float>::Add(float const&)
Undefined symbol: google::protobuf::RepeatedField<float>::Clear()
Undefined symbol: google::protobuf::RepeatedField<float>::MergeFrom(google::protobuf::RepeatedField<float> const&)
Undefined symbol: google::protobuf::RepeatedField<float>::RepeatedField(google::protobuf::Arena*)
Undefined symbol: google::protobuf::RepeatedField<float>::RepeatedField(google::protobuf::RepeatedField<float> const&)
Undefined symbol: google::protobuf::RepeatedField<float>::~RepeatedField()
Undefined symbol: google::protobuf::stringpiece_internal::StringPiece::LogFatalSizeTooBig(unsigned long, char const*)
Undefined symbol: google::protobuf::io::EpsCopyOutputStream::WriteRawFallback(void const*, int, unsigned char*)
Undefined symbol: google::protobuf::io::EpsCopyOutputStream::EnsureSpaceFallback(unsigned char*)
Undefined symbol: google::protobuf::io::EpsCopyOutputStream::WriteStringMaybeAliasedOutline(unsigned int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, unsigned char*)
Undefined symbol: google::protobuf::Arena::AllocateAlignedWithHook(unsigned long, std::type_info const*)
Undefined symbol: google::protobuf::Arena::AllocateAlignedWithCleanup(unsigned long, std::type_info const*)
Undefined symbol: google::protobuf::internal::LogMessage::LogMessage(google::protobuf::LogLevel, char const*, int)
Undefined symbol: google::protobuf::internal::LogMessage::~LogMessage()
Undefined symbol: google::protobuf::internal::LogMessage::operator<<(char const*)
Undefined symbol: google::protobuf::internal::LogFinisher::operator=(google::protobuf::internal::LogMessage&)
Undefined symbol: google::protobuf::internal::WriteVarint(unsigned int, unsigned long long, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*)
Undefined symbol: google::protobuf::internal::ArenaStringPtr::DestroyNoArenaSlowPath()
Undefined symbol: google::protobuf::internal::ArenaStringPtr::Set(google::protobuf::internal::ArenaStringPtr::EmptyDefault, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, google::protobuf::Arena*)
Undefined symbol: google::protobuf::internal::ArenaStringPtr::Mutable(google::protobuf::internal::ArenaStringPtr::EmptyDefault, google::protobuf::Arena*)
Undefined symbol: google::protobuf::internal::LookUpEnumName(google::protobuf::internal::EnumEntry const*, int const*, unsigned long, int)
Undefined symbol: google::protobuf::internal::LookUpEnumValue(google::protobuf::internal::EnumEntry const*, unsigned long, google::protobuf::stringpiece_internal::StringPiece, int*)
Undefined symbol: google::protobuf::internal::ReadTagFallback(char const*, unsigned int)
Undefined symbol: google::protobuf::internal::ThreadSafeArena::~ThreadSafeArena()
Undefined symbol: void google::protobuf::internal::InternalMetadata::DoMergeFrom<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Undefined symbol: void google::protobuf::internal::InternalMetadata::DoClear<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >()
Undefined symbol: google::protobuf::internal::PackedFloatParser(void*, char const*, google::protobuf::internal::ParseContext*)
Undefined symbol: google::protobuf::internal::UnknownFieldParse(unsigned int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, char const*, google::protobuf::internal::ParseContext*)
Undefined symbol: google::protobuf::internal::VarintParseSlow64(char const*, unsigned int)
Undefined symbol: google::protobuf::internal::EpsCopyInputStream::DoneFallback(int, int)
Undefined symbol: google::protobuf::internal::InitializeEnumStrings(google::protobuf::internal::EnumEntry const*, int const*, unsigned long, google::protobuf::internal::ExplicitlyConstructed<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >*)
Undefined symbol: google::protobuf::internal::InitProtobufDefaultsSlow()
Undefined symbol: google::protobuf::internal::InlineGreedyStringParser(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, char const*, google::protobuf::internal::ParseContext*)
Undefined symbol: google::protobuf::internal::fixed_address_empty_string
Undefined symbol: google::protobuf::internal::init_protobuf_defaults_state
Undefined symbol: google::protobuf::MessageLite::InitializationErrorString() const
Undefined symbol: google::protobuf::RepeatedField<float>::Get(int) const
Undefined symbol: google::protobuf::RepeatedField<float>::data() const
Undefined symbol: google::protobuf::RepeatedField<float>::size() const
Undefined symbol: typeinfo for google::protobuf::MessageLite
Undefined symbol: vtable for google::protobuf::MessageLite

google::protobuf が見つからない

対応としては、iOS 用のビルドフォルダに移動

pod init
pod install

podfile を以下に変更

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'Unity-iPhone' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for Unity-iPhone

  target 'Unity-iPhone Tests' do
    inherit! :search_paths
    # Pods for testing
  end

end

target 'UnityFramework' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!
  # add
  pod 'Protobuf-C++', '3.18.0'

  # Pods for UnityFramework

end

# add
post_install do |installer|
  installer.pods_project.targets.each do |target|
    # print "target=", target, "\n"
    if target.name == "Protobuf-C++"
      target.build_configurations.each do |config|
        config.build_settings['HEADER_SEARCH_PATHS'] = '$(SRCROOT)/Protobuf-C++/src'
      end
    end
  end
end

xcworkspace が作成されるので以下のコマンドで open

pod update
open Unity-iPhone.xcworkspace

あとは、署名してビルド

 

https://developers.google.com/cardboard/develop/unity/quickstart

 

Unity ver.2020.3.38

Mac ver.12.6

Android Sdk ver.30

 

Google Cardboard  のデモをAndroid 用にビルドしたら以下のエラー

> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource linking failed
/Users/falco/.gradle/caches/transforms-2/files-2.1/a0ebba694f8e6a95bc427eaef4894530/material-1.6.1/res/values-v31/values-v31.xml:3:5-94: AAPT: error: resource android:color/system_neutral1_1000 not found.

/Users/falco/.gradle/caches/transforms-2/files-2.1/a0ebba694f8e6a95bc427eaef4894530/material-1.6.1/res/values-v31/values-v31.xml:4:5-94: AAPT: error: resource android:color/system_neutral1_900 not found.

/Users/falco/.gradle/caches/transforms-2/files-2.1/a0ebba694f8e6a95bc427eaef4894530/material-1.6.1/res/values-v31/values-v31.xml:5:5-93: AAPT: error: resource android:color/system_neutral1_0 not found.

/Users/falco/.gradle/caches/transforms-2/files-2.1/a0ebba694f8e6a95bc427eaef4894530/material-1.6.1/res/values-v31/values-v31.xml:6:5-94: AAPT: error: resource android:color/system_neutral1_800 not found.

/Users/falco/.gradle/caches/transforms-2/files-2.1/a0ebba694f8e6a95bc427eaef4894530/material-1.6.1/res/values-v31/values-v31.xml:7:5-94: AAPT: error: resource android:color/system_neutral1_700 not found.

/Users/falco/.gradle/caches/transforms-2/files-2.1/a0ebba694f8e6a95bc427eaef4894530/material-1.6.1/res/values-v31/values-v31.xml:8:5-94: AAPT: error: resource android:color/system_neutral1_600 not found.

/Users/falco/.gradle/caches/transforms-2/files-2.1/a0ebba694f8e6a95bc427eaef4894530/material-1.6.1/res/values-v31/values-v31.xml:9:5-94: AAPT: error: resource android:color/system_neutral1_500 not found.

/Users/falco/.gradle/caches/transforms-2/files-2.1/a0ebba694f8e6a95bc427eaef4894530/material-1.6.1/res/values-v31/values-v31.xml:10:5-94: AAPT: error: resource android:color/system_neutral1_400 not found.

/Users/falco/.gradle/caches/transforms-2/files-2.1/a0ebba694f8e6a95bc427eaef4894530/material-1.6.1/res/values-v31/values-v31.xml:11:5-94: AAPT: error: resource android:color/system_neutral1_300 not found.

/Users/falco/.gradle/caches/transforms-2/files-2.1/a0ebba694f8e6a95bc427eaef4894530/material-1.6.1/res/values-v31/values-v31.xml:12:5-94: AAPT: error: resource android:color/system_neutral1_200 not found.

/Users/falco/.gradle/caches/transforms-2/files-2.1/a0ebba694f8e6a95bc427eaef4894530/material-1.6.1/res/values-v31/values-v31.xml:13:5-94: AAPT: error: resource android:color/system_neutral1_100 not found.

/Users/falco/.gradle/caches/transforms-2/files-2.1/a0ebba694f8e6a95bc427eaef4894530/material-1.6.1/res/values-v31/values-v31.xml:14:5-93: AAPT: error: resource android:color/system_neutral1_50 not found.

/Users/falco/.gradle/caches/transforms-2/files-2.1/a0ebba694f8e6a95bc427eaef4894530/material-1.6.1/res/values-v31/values-v31.xml:15:5-93: AAPT: error: resource android:color/system_neutral1_10 not found.

/Users/falco/.gradle/caches/transforms-2/files-2.1/a0ebba694f8e6a95bc427eaef4894530/material-1.6.1/res/values-v31/values-v31.xml:16:5-102: AAPT: error: resource android:color/system_neutral2_1000 not found.

/Users/falco/.gradle/caches/transforms-2/files-2.1/a0ebba694f8e6a95bc427eaef4894530/material-1.6.1/res/values-v31/values-v31.xml:17:5-102: AAPT: error: resource android:color/system_neutral2_900 not found.

/Users/falco/.gradle/caches/transforms-2/files-2.1/a0ebba694f8e6a95bc427eaef4894530/material-1.6.1/res/values-v31/values-v31.xml:18:5-101: AAPT: error: resource android:color/system_neutral2_0 not found.

/Users/falco/.gradle/caches/transforms-2/files-2.1/a0ebba694f8e6a95bc427eaef4894530/material-1.6.1/res/values-v31/values-v31.xml:19:5-102: AAPT: error: resource android:color/system_neutral2_800 not found.

/Users/falco/.gradle/caches/transforms-2/files-2.1/a0ebba694f8e6a95bc427eaef4894530/material-1.6.1/res/values-v31/values-v31.xml:20:5-102: AAPT: error: resource android:color/system_neutral2_700 not found.

/Users/falco/.gradle/caches/transforms-2/files-2.1/a0ebba694f8e6a95bc427eaef4894530/material-1.6.1/res/values-v31/values-v31.xml:21:5-102: AAPT: error: resource android:color/system_neutral2_600 not found.

/Users/falco/.gradle/caches/transforms-2/files-2.1/a0ebba694f8e6a95bc427eaef4894530/material-1.6.1/res/values-v31/values-v31.xml:22:5-102: AAPT: error: resource android:color/system_neutral2_500 not found.

リソースが見つからない…

 

対応としては、ライブラリーをダウングレード

// implementation 'androidx.appcompat:appcompat:1.4.2'
implementation 'com.google.android.gms:play-services-vision:20.1.3'
// implementation 'com.google.android.material:material:1.6.1'
implementation 'com.google.protobuf:protobuf-javalite:3.19.4'

implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.4.0'

これでビルド出来た。

© 2024 Falco Tech Blog Suffusion theme by Sayontan Sinha