トマシープが学ぶ

Unity/VR/AR/デザイン好きのミーハー 記事内容は自分用のメモです

UnityでQuest用にAndrodiビルドしたらOculusエラーが出る

環境

Unity2018.4.17

エラー

OculusIntegrationが入っているUnityプロジェクトをAndroidビルドしたらエラーがでいてた。

f:id:bibinbaleo:20200331094322p:plain

でもapkは生成されているし、Failedはでていない。

 エラー文

NullReferenceException: Object reference not set to an instance of an object
UnityEditor.XR.Oculus.OculusManifest.UpdateOrCreateNameValueElementsInTag (System.Xml.XmlDocument doc, System.String parentPath, System.String tag, System.String firstName, System.String firstValue, System.String secondName, System.String secondValue, System.String thirdName, System.String thirdValue) (at Library/PackageCache/com.unity.xr.oculus.android@1.38.3/Editor/OculusBuildProcessor.cs:60)
UnityEditor.XR.Oculus.OculusManifest.OnPostGenerateGradleAndroidProject (System.String path) (at Library/PackageCache/com.unity.xr.oculus.android@1.38.3/Editor/OculusBuildProcessor.cs:102)
UnityEditor.Android.AndroidBuildPipelineInterfaces.OnGeneratePlatformProjectPostprocess (System.String path, System.Boolean strict) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Android/AndroidPostGenerateGradleProject.cs:39)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

 ググったら同じ人いた。

teratail.com

フォーラム

https://forum.unity.com/threads/error-after-upgrading-from-unity-2019-1-13f1-to-2019-2-5f1.748094/

V2Signing

上の二つを見たらV2Signingのチェックを外したら治ったって書いてある。

V2signingってどこだ?

「playersettingのvrsettingにあるV2signingをuncheckにした」とあるが分からない。

f:id:bibinbaleo:20200331092433p:plain

PlayerSettings.VROculus.v2Signingにあるらしいが?

docs.unity3d.com

???

結局わからなかった。

OculusBuildProcessor.cs

フォーラムにあるようにOculusBuildProcessor.csのエラーが出た行をコメントアウトしたらエラー出なくなった!

It's a bug in Oculus Android package.
You can get a hint looking into the OculusBuildProcessor.cs script in the package. Cached in Library/PackageCache/com.unity.xr.oculus.android@X.XX.X\Editor
Check the line you get in the error's call stack. In your case it's OculusBuildProcessor.cs:130
It can't handle required attributes like:

Code (CSharp):
  1. <meta-data android:name="com.samsung.android.vr.application.mode" android:value="vr_only"/>
  2. android:launchMode="singleTask"
  3. android:resizeableActivity="false"

You can safely remove these attributes because these will be added automatically. The one that caused problems for me (no idea why) was vr_only meta-data.

 

場所はここ

f:id:bibinbaleo:20200331095409p:plain

私は102行目でエラーが出てた。

f:id:bibinbaleo:20200331094857p:plain

 Build or Build&Run

私はエラーは出るもののBuild自体は成功してた。

Buildだけでビルドするか、Build&Runでビルドするかの違いみたい!

Buildだけだとビルドできる。

最後に

原因はなんだろう?

Unity2018.3.8で作られていたものを2018.4.17で開いたせいかな?

 

これとは違う

bibinbaleo.hatenablog.com