Build failed after creating oculus go manifest in Unity 3D

倾然丶 夕夏残阳落幕 提交于 2020-02-05 15:53:50

问题


I am trying to publish an Oculus GO application build with Unity 3D. I follow the OVR instructions for publishing such apps which can be found here: https://developer.oculus.com/documentation/mobilesdk/latest/concepts/mobile-native-manifest/

The instructions mention that you have to use Oculus -> Tools -> Create Store Compatible AndroidManifest.xml and then fill it with the details of your application.

The AndroidManifest.xml file the Oculus Tool produces is the following:

<?xml version="1.0" encoding="utf-8" standalone="no"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    android:installLocation="auto">
    <application
        android:allowBackup="false">
        <activity
            android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
            android:configChanges="locale|fontScale|keyboard|keyboardHidden|mcc|mnc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|touchscreen|uiMode"
            android:launchMode="singleTask"
            android:name="com.unity3d.player.UnityPlayerActivity"
            android:excludeFromRecents="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.INFO"/>
            </intent-filter>
        </activity>
        <meta-data android:name="unityplayer.SkipPermissionsDialog" android:value="false" />
    </application>
</manifest>

My manifest file after editing it based on the instructions on the Oculus website above (e.g. adding package name etc) looks like:

<?xml version="1.0" encoding="utf-8" standalone="no"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="xx.xx.xx"
          android:versionCode="1" 
          android:versionName="1.0" 
    android:installLocation="auto">
    <application>
      <meta-data android:name="com.samsung.android.vr.application.mode" android:value="vr_only"/>
        <activity
            android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
            android:configChanges="density|keyboard|keyboardHidden|navigation|orientation|screenLayout|screenSize|uiMode"
            android:launchMode="singleTask"
            android:name="com.unity3d.player.UnityPlayerActivity"
            android:excludeFromRecents="true"
            android:resizeableActivity="false"
            >
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.INFO"/>
            </intent-filter>
        </activity>
        <meta-data android:name="unityplayer.SkipPermissionsDialog" android:value="false" />
    </application>
  <uses-sdk android:minSdkVersion="21"/>
  <uses-feature android:glEsVersion="0x00030001" />
</manifest>

When I try to build the application it shows the following error:

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.2/Editor/OculusBuildProcessor.cs:60)
UnityEditor.XR.Oculus.OculusManifest.OnPostGenerateGradleAndroidProject (System.String path) (at Library/PackageCache/com.unity.xr.oculus.android@1.38.2/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)

I have to mention that if I build the application without using this AndroidManifest.xml file created using the Oculus Tool it builds just fine.


回答1:


I have solve this problem

1-Delete the AndroidManifest from my project

2-Edit in AndroidManifest.OVRSubmission

<category android:name="android.intent.category.INFO"/>
 change this line with 
<category android:name="android.intent.category.LAUNCHER"/>



回答2:


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:102 It can't handle required attributes like:

<meta-data android:name="com.samsung.android.vr.application.mode" android:value="vr_only"/>
android:launchMode="singleTask"
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.



来源:https://stackoverflow.com/questions/57761357/build-failed-after-creating-oculus-go-manifest-in-unity-3d

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!