起きたこと
Unity2019.1.14fで
Oculus GoへビルドするためのVRシーンを作成していたところ以下のエラーでビルドできなくなりました。
Gradle Error: Resource Not Found
Resource 'xml/network_sec_config' not found in AndroidManifest.xml:46,
(See the Console for details)
CommandInvokationFailure: Gradle build failed.
/Applications/2019.1.14f1/PlaybackEngines/AndroidPlayer/Tools/OpenJDK/MacOS/bin/java -classpath "/Applications/2019.1.14f1/PlaybackEngines/AndroidPlayer/Tools/gradle/lib/gradle-launcher-5.1.1.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "assembleRelease"
stderr[
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':processReleaseResources'.
> Android resource linking failed
/Users/arisaito/git/New Unity Project (1)/Temp/gradleOut/build/intermediates/merged_manifests/release/AndroidManifest.xml:46: AAPT: error: resource xml/network_sec_config (aka com.au.test:xml/network_sec_config) not found.
error: failed processing manifest.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 5s
]
stdout[
> Configure project :
WARNING: The specified Android SDK Build Tools version (19.1.0) is ignored, as it is below the minimum supported version (28.0.3) for Android Gradle Plugin 3.4.0.
Android SDK Build Tools 28.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '19.1.0'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
> Task :preBuild UP-TO-DATE
> Task :preReleaseBuild
> Task :compileReleaseAidl NO-SOURCE
> Task :compileReleaseRenderscript NO-SOURCE
> Task :checkReleaseManifest
> Task :generateReleaseBuildConfig
> Task :prepareLintJar
> Task :generateReleaseSources
> Task :javaPreCompileRelease
> Task :mainApkListPersistenceRelease
> Task :generateReleaseResValues
> Task :generateReleaseResources
> Task :mergeReleaseResources
> Task :createReleaseCompatibleScreenManifests
> Task :processReleaseManifest
> Task :processReleaseResources FAILED
Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.1.1/userguide/command_line_interface.html#sec:command_line_warnings
11 actionable tasks: 11 executed
]
exit code: 1
UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <1e5e55a0ebac44e989773ba5d6df4794>:0)
UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <1e5e55a0ebac44e989773ba5d6df4794>:0)
UnityEditor.Android.Command.Run (System.String command, System.String args, System.String workingdir, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <1e5e55a0ebac44e989773ba5d6df4794>:0)
UnityEditor.Android.AndroidJavaTools.RunJava (System.String args, System.String workingdir, System.Action`1[T] progress, System.String error) (at <1e5e55a0ebac44e989773ba5d6df4794>:0)
UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action`1[T] progress) (at <1e5e55a0ebac44e989773ba5d6df4794>:0)
Rethrow as GradleInvokationException: Gradle build failed
UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action`1[T] progress) (at <1e5e55a0ebac44e989773ba5d6df4794>:0)
UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <1e5e55a0ebac44e989773ba5d6df4794>:0)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <1e5e55a0ebac44e989773ba5d6df4794>:0)
UnityEditor.Android.PostProcessAndroidPlayer.PostProcess (UnityEditor.BuildTarget target, System.String stagingAreaData, System.String stagingArea, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at <1e5e55a0ebac44e989773ba5d6df4794>:0)
UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <1e5e55a0ebac44e989773ba5d6df4794>:0)
UnityEditor.PostprocessBuildPlayer.Postprocess (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target, System.String installPath, System.String companyName, System.String productName, System.Int32 width, System.Int32 height, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:281)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
解決方法
すみません、本当に初歩的なところなんですが、
Oculus対応するために「Oculus Integration」のアセットをダウンロードして、
その後Assets/hoge/Oculusという感じでデフォルトのAssetsフォルダ直下から移動させていたことが原因でした。
Assets直下に戻したらビルド成功しました。
その他参考
Unityビルド時のplayer settingはこちらを参考にしました
https://qiita.com/relzx/items/7f8e7817c9edd11c5023
Unity2019のその他ビルドエラーはこちらが参考になりそうです。
http://nn-hokuson.hatenablog.com/entry/2017/09/05/202327