我试图用ARcore构建Android项目。它返回了Gradle构建错误。我不认为我做错了什么,因为我什至还没有做任何事情。它仅包含AR会话。再次,没有任何代码错误或任何东西。
CommandInvokationFailure: Gradle build failed.
以下是一些详细的错误消息:
C:/Program Files/Unity/Hub/Editor/2019.4.13f1/Editor/Data/PlaybackEngines/AndroidPlayer\OpenJDK\bin\java.exe -classpath "C:\Program Files\Unity\Hub\Editor\2019.4.13f1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-5.1.1.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx98304m" "assembleRelease"
stderr[
[:arcore_client:] C:\Users\JU\.gradle\caches\transforms-2\files-2.1\e0b400c4f1c475177237bdff8a04164d\AndroidManifest.xml:30:9-54 Error:
Missing 'package' key attribute on element package at [:arcore_client:] AndroidManifest.xml:30:9-54
[:arcore_client:] C:\Users\JU\.gradle\caches\transforms-2\files-2.1\e0b400c4f1c475177237bdff8a04164d\AndroidManifest.xml Error:
Validation failed, exiting
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':launcher:processReleaseManifest'.
> Manifest merger failed with multiple errors, see logs
* 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 2s
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
]
stdout[
> Configure project :launcher
Exception while marshalling C:\Program Files\Unity\Hub\Editor\2019.4.13f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\build-tools\28.0.3\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files\Unity\Hub\Editor\2019.4.13f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platform-tools\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files\Unity\Hub\Editor\2019.4.13f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platforms\android-29\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files\Unity\Hub\Editor\2019.4.13f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\tools\package.xml. Probably the SDK is read-only
> Task :launcher:preBuild UP-TO-DATE
> Task :unityLibrary:preBuild UP-TO-DATE
> Task :unityLibrary:preReleaseBuild UP-TO-DATE
> Task :unityLibrary:checkReleaseManifest UP-TO-DATE
> Task :launcher:prepareLintJar UP-TO-DATE
> Task :unityLibrary:processReleaseManifest
> Task :unityLibrary:compileReleaseAidl NO-SOURCE
> Task :unityLibrary:packageReleaseRenderscript NO-SOURCE
> Task :unityLibrary:compileReleaseRenderscript NO-SOURCE
> Task :unityLibrary:generateReleaseBuildConfig UP-TO-DATE
> Task :unityLibrary:generateReleaseResValues UP-TO-DATE
> Task :unityLibrary:generateReleaseResources UP-TO-DATE
> Task :unityLibrary:packageReleaseResources UP-TO-DATE
> Task :unityLibrary:generateReleaseRFile UP-TO-DATE
> Task :unityLibrary:prepareLintJar UP-TO-DATE
> Task :unityLibrary:generateReleaseSources UP-TO-DATE
> Task :launcher:preReleaseBuild
> Task :launcher:compileReleaseAidl NO-SOURCE
> Task :unityLibrary:javaPreCompileRelease UP-TO-DATE
> Task :launcher:compileReleaseRenderscript NO-SOURCE
> Task :launcher:checkReleaseManifest UP-TO-DATE
> Task :unityLibrary:compileReleaseJavaWithJavac UP-TO-DATE
> Task :launcher:generateReleaseBuildConfig
> Task :launcher:generateReleaseSources
> Task :launcher:mainApkListPersistenceRelease UP-TO-DATE
> Task :launcher:generateReleaseResValues UP-TO-DATE
> Task :launcher:generateReleaseResources UP-TO-DATE
> Task :unityLibrary:bundleLibCompileRelease
> Task :unityLibrary:prepareLintJarForPublish
> Task :unityLibrary:mergeReleaseShaders
> Task :unityLibrary:compileReleaseShaders
> Task :unityLibrary:generateReleaseAssets
> Task :launcher:mergeReleaseResources UP-TO-DATE
> Task :launcher:javaPreCompileRelease
> Task :launcher:createReleaseCompatibleScreenManifests UP-TO-DATE
> Task :launcher:processReleaseManifest FAILED
See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.
> Task :unityLibrary:packageReleaseAssets
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
24 actionable tasks: 10 executed, 14 up-to-date
]
exit code: 1
UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <4787bab5d6924cfaa63b02c00dafc983>:0)
UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <4787bab5d6924cfaa63b02c00dafc983>:0)
UnityEditor.Android.Command.Run (System.String command, System.String args, System.String workingdir, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <4787bab5d6924cfaa63b02c00dafc983>:0)
UnityEditor.Android.AndroidJavaTools.RunJava (System.String args, System.String workingdir, System.Action`1[T] progress, System.String error) (at <4787bab5d6924cfaa63b02c00dafc983>:0)
UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action`1[T] progress) (at <4787bab5d6924cfaa63b02c00dafc983>: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 <4787bab5d6924cfaa63b02c00dafc983>:0)
UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <4787bab5d6924cfaa63b02c00dafc983>:0)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <4787bab5d6924cfaa63b02c00dafc983>:0)
Rethrow as BuildFailedException: Exception of type 'UnityEditor.Build.BuildFailedException' was thrown.
UnityEditor.Android.PostProcessor.CancelPostProcess.AbortBuild (System.String title, System.String message, System.Exception ex) (at <4787bab5d6924cfaa63b02c00dafc983>:0)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <4787bab5d6924cfaa63b02c00dafc983>: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 <4787bab5d6924cfaa63b02c00dafc983>:0)
UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <4787bab5d6924cfaa63b02c00dafc983>: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 <1fe7a3c0284a456b9681b7a93141c89a>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPt
r)
答案 0 :(得分:0)
这是由于gradle 文件配置问题。您必须在 Unity 3D 2019+ 版本的自定义 gradle 文件中手动进行一些更改。
您可以在以下链接中查看我对此问题的解决方案: