ryuryu0226 / ARMap

1 stars 0 forks source link

iOS: ログ 2022-06-25 #5

Open hzuika opened 2 years ago

hzuika commented 2 years ago

1c81d53コミットをMacで開こうとした.

error CS0234: The type or namespace name 'AndroidPlatformIconKind' does not exist in the namespace 'UnityEditor.Android' (are you missing an assembly reference?)

✅ Assets/Samples/ARCore Extensions/1.31.0/Geospatial Sample/Scripts/Editor/GeospatialPreprocessBuild.csの削除

Enter Safe Mode?

The project you are opening contains compilation errors.

Entering Safe Mode allows you to resolve these errors without waiting for the rest of your project to import.

If you select Ignore (not recommended), your project will continue to import, but it may be in a broken or unusable state.
image

Safe Modeはエラーが解決されるまでインポートを中断する? とりあえず,Enter Safe Modeで開く.

Consoleに表示されたエラー

Assets/Samples/ARCore Extensions/1.31.0/Geospatial Sample/Scripts/Editor/GeospatialPreprocessBuild.cs(82,25): error CS0234: The type or namespace name 'AndroidPlatformIconKind' does not exist in the namespace 'UnityEditor.Android' (are you missing an assembly reference?)

名前空間が存在しないエラーが発生している. そもそも,Android?が出ているのはなぜだろう.

Assets/Samples/ARCore Extensions/1.31.0/Geospatial Sample/Scripts/Editor/GeospatialPreprocessBuild.cs(100,21): error CS0234: The type or namespace name 'AndroidPlatformIconKind' does not exist in the namespace 'UnityEditor.Android' (are you missing an assembly reference?)

エラーが出ているソースコードを確認してみる. Assets/Samples/ARCore Extensions/1.31.0/Geospatial Sample/Scripts/Editor/GeospatialPreprocessBuild.cs:L74

            if (report.summary.platform == BuildTarget.Android)

report.summary.platformがAndroidになってしまっている. ビルドターゲットを変更しないといけないと予想.

Safe Modeからビルドの設定を変えられそうになかったので,Exit Safe Modeする.

File > Build Settings を確認すると,ちゃんと iOSになっていた.

あと,なんか出てきた.

image

とりあえずビルドしようとするとエラー

Error building Player because scripts have compile errors in the editor

Build completed with a result of 'Failed' in 2 seconds (2114 ms)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&) (at /Users/bokken/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:189)

UnityEditor.BuildPlayerWindow+BuildMethodException: Error building Player because scripts have compile errors in the editor
  at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x002be] in /Users/bokken/buildslave/unity/build/Editor/Mono/BuildPlayerWindowBuildMethods.cs:190 
  at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x00080] in /Users/bokken/buildslave/unity/build/Editor/Mono/BuildPlayerWindowBuildMethods.cs:95 
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&) (at /Users/bokken/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:189)

Assets/Samples/ARCore Extensions/1.31.0/Geospatial Sample/Scripts/Editor/GeospatialPreprocessBuild.cs(82,25): error CS0234: The type or namespace name 'AndroidPlatformIconKind' does not exist in the namespace 'UnityEditor.Android' (are you missing an assembly reference?)

Assets/Samples/ARCore Extensions/1.31.0/Geospatial Sample/Scripts/Editor/GeospatialPreprocessBuild.cs(100,21): error CS0234: The type or namespace name 'AndroidPlatformIconKind' does not exist in the namespace 'UnityEditor.Android' (are you missing an assembly reference?)

結局,名前空間がAndroidになっているところをどうにかしないとビルドできなさそう.

hzuika commented 2 years ago

GeospatialPreprocessBuild.cs

iOSでもこれがTrueになってif文の中のAndroid用のコードが実行されてしまう. https://github.com/ryuryu0226/ARMap/blob/b746fd1a60b672f536fed199fe3bcc32f18bb315/ARMap/Assets/Samples/ARCore%20Extensions/1.31.0/Geospatial%20Sample/Scripts/Editor/GeospatialPreprocessBuild.cs#L74

これはOnPreprocessBuildという関数の中の処理. OnPreprocessBuildはビルドが始まる前に呼び出される関数. report引数には,ターゲットプラットフォームや,出力パスなどのビルド情報が含まれている. https://github.com/ryuryu0226/ARMap/blob/b746fd1a60b672f536fed199fe3bcc32f18bb315/ARMap/Assets/Samples/ARCore%20Extensions/1.31.0/Geospatial%20Sample/Scripts/Editor/GeospatialPreprocessBuild.cs#L46-L53

hzuika commented 2 years ago

Target platformを指定してUnityを開く

Unity HubのEditor versionを開いてiOSを選択して開く. さきほどと同じエラーが出る.

Assets/Samples/ARCore Extensions/1.31.0/Geospatial Sample/Scripts/Editor/GeospatialPreprocessBuild.cs(82,25): error CS0234: The type or namespace name 'AndroidPlatformIconKind' does not exist in the namespace 'UnityEditor.Android' (are you missing an assembly reference?)

Assets/Samples/ARCore Extensions/1.31.0/Geospatial Sample/Scripts/Editor/GeospatialPreprocessBuild.cs(100,21): error CS0234: The type or namespace name 'AndroidPlatformIconKind' does not exist in the namespace 'UnityEditor.Android' (are you missing an assembly reference?)

参考

hzuika commented 2 years ago

Project settings

次の2つをMicrophone Usage Descriptionと同じ設定(Required for augmented reality support.)にする

image
hzuika commented 2 years ago

✅ エラーになるスクリプトごと削除するとビルドが通る

一応ビルドは通るけれど,これでいいのだろうか

rm -rf Assets/Samples/ARCore Extensions/1.31.0/Geospatial Sample/Scripts/Editor

参考

hzuika commented 2 years ago

❌Xcodeでフレームワークが見つからないエラー(framework not found FBLPromises)

xcodeprojファイルではなく,xcworkspaceファイルを開いてデバッグ実行する

ビルドしたプロジェクトをXcodeで開いて実行しようとするとエラーが発生.

ld: warning: directory not found for option '-F/Users/hashi/Library/Developer/Xcode/DerivedData/Unity-iPhone-gqqqdtpvwrzecsdiehpaubihnvnd/Build/Products/ReleaseForRunning-iphoneos/FirebaseABTesting'
ld: warning: directory not found for option '-F/Users/hashi/Library/Developer/Xcode/DerivedData/Unity-iPhone-gqqqdtpvwrzecsdiehpaubihnvnd/Build/Products/ReleaseForRunning-iphoneos/FirebaseCore'
ld: warning: directory not found for option '-F/Users/hashi/Library/Developer/Xcode/DerivedData/Unity-iPhone-gqqqdtpvwrzecsdiehpaubihnvnd/Build/Products/ReleaseForRunning-iphoneos/FirebaseCoreDiagnostics'
ld: warning: directory not found for option '-F/Users/hashi/Library/Developer/Xcode/DerivedData/Unity-iPhone-gqqqdtpvwrzecsdiehpaubihnvnd/Build/Products/ReleaseForRunning-iphoneos/FirebaseInstallations'
ld: warning: directory not found for option '-F/Users/hashi/Library/Developer/Xcode/DerivedData/Unity-iPhone-gqqqdtpvwrzecsdiehpaubihnvnd/Build/Products/ReleaseForRunning-iphoneos/FirebaseRemoteConfig'
ld: warning: directory not found for option '-F/Users/hashi/Library/Developer/Xcode/DerivedData/Unity-iPhone-gqqqdtpvwrzecsdiehpaubihnvnd/Build/Products/ReleaseForRunning-iphoneos/GoogleDataTransport'
ld: warning: directory not found for option '-F/Users/hashi/Library/Developer/Xcode/DerivedData/Unity-iPhone-gqqqdtpvwrzecsdiehpaubihnvnd/Build/Products/ReleaseForRunning-iphoneos/GoogleToolboxForMac'
ld: warning: directory not found for option '-F/Users/hashi/Library/Developer/Xcode/DerivedData/Unity-iPhone-gqqqdtpvwrzecsdiehpaubihnvnd/Build/Products/ReleaseForRunning-iphoneos/GoogleUtilities'
ld: warning: directory not found for option '-F/Users/hashi/Library/Developer/Xcode/DerivedData/Unity-iPhone-gqqqdtpvwrzecsdiehpaubihnvnd/Build/Products/ReleaseForRunning-iphoneos/PromisesObjC'
ld: warning: directory not found for option '-F/Users/hashi/Library/Developer/Xcode/DerivedData/Unity-iPhone-gqqqdtpvwrzecsdiehpaubihnvnd/Build/Products/ReleaseForRunning-iphoneos/nanopb'
ld: framework not found FBLPromises
clang: error: linker command failed with exit code 1 (use -v to see invocation)

参考

framework not found FBLPromises · Issue #166 · googlesamples/mlkit

試したこと

❌ Project > Build Settings > Build Active Architecture Only をNoにしてClean Build Folderしてからビルドしても同じエラーが出た.

hzuika commented 2 years ago

❌初期化失敗

https://github.com/ryuryu0226/ARMap/issues/4#issuecomment-1166297950

コメントに貼り付けたときはEarthManager.EarthTrackingState!=TrackingState.Tracking:Trueだったが,二回目の実行時はFalseだった.

アプリ画面のデバッグ表示.

! Initializer.IsReady: True
EarthManager.EarthTrackingState!=TrackingState.Tracking:False
ARSession.state == ARSessionState.SessionTracking: True
hzuika commented 2 years ago

上のコメントのアプリ画面 3D02923C-FD20-47EE-9309-BC2258D667AF 別issueでコメントしたときのアプリ画面 4541ADC0-7D80-4F76-8A3D-733AC9896888