【发布时间】:2021-01-22 06:09:17
【问题描述】:
这是堆栈跟踪给我的信息
我使用 unity hub 安装了 unity 并设置了 JAVA_HOME 环境变量
谁能指出哪里出错了?
1.BuildFailedException: Main Gradle template is not used in this build. ARCore SDK for Unity requires gradle plugin version >= 3.6.0. Nevigate to 'Project Settings > Player > Android Tab > Publish Settings > Build', check 'Custom Gradle Template'. Then edit the generated file 'Assets/Plugins/Android/mainTemplate.gradle' by adding dependency 'com.android.tools.build:gradle:3.6.0.'. GoogleARCoreInternal.ARCoreAndroidSupportPreprocessBuild.CheckMainGradle () (at Assets/GoogleARCore/SDK/Scripts/Editor/ARCoreAndroidSupportPreprocessBuild.cs:135) GoogleARCoreInternal.ARCoreAndroidSupportPreprocessBuild.OnPreprocessBuild (UnityEditor.BuildTarget target, System.String path) (at Assets/GoogleARCore/SDK/Scripts/Editor/ARCoreAndroidSupportPreprocessBuild.cs:59) GoogleARCoreInternal.PreprocessBuildBase.OnPreprocessBuild (UnityEditor.Build.Reporting.BuildReport report) (at Assets/GoogleARCore/SDK/Scripts/Editor/PreprocessBuildBase.cs:52) UnityEditor.Build.BuildPipelineInterfaces+<>c_DisplayClass15_0.b_1 (UnityEditor.Build.IPreprocessBuildWithReport bpp) (at :0) UnityEditor.Build.BuildPipelineInterfaces.InvokeCallbackInterfacesPair[T1,T2] (System.Collections.Generic.List`1[T] oneInterfaces, System.Action`1[T] invocationOne, System.Collections.Generic.List`1[T] twoInterfaces, System.Action`1[T] invocationTwo, System.Boolean exitOnFailure) (at :0) UnityEditor.EditorApplication:Internal_CallGlobalEventHandler()
2.Error building Player: BuildFailedException: Main Gradle template is not used in this build. ARCore SDK for Unity requires gradle plugin version >= 3.6.0. Nevigate to 'Project Settings > Player > Android Tab > Publish Settings > Build', check 'Custom Gradle Template'. Then edit the generated file 'Assets/Plugins/Android/mainTemplate.gradle' by adding dependency 'com.android.tools.build:gradle:3.6.0.'.
3.Build completed with a result of 'Failed' in 0 seconds (111 ms) 0x00007FF61BAE837C (Unity) StackWalker::GetCurrentCallstack 0x00007FF61BAEC331 (Unity) StackWalker::ShowCallstack 0x00007FF61A1BAE95 (Unity) GetStacktrace 0x00007FF61C76BE7E (Unity) DebugStringToFile 0x00007FF61BB47735 (Unity) DebugLogHandler_CUSTOM_Internal_Log 0x0000012782FEB3AB (Mono JIT Code) (wrapper managed-to-native) UnityEngine.DebugLogHandler:Internal_Log (UnityEngine.LogType,UnityEngine.LogOption,string,UnityEngine.Object) 0x0000012782FEB24B (Mono JIT Code) UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[]) 0x0000012782FEA90E (Mono JIT Code) UnityEngine.Logger:Log (UnityEngine.LogType,object) 0x0000012782FEA66A (Mono JIT Code) UnityEngine.Debug:LogError (object) 0x0000012782FB3B33 (Mono JIT Code) UnityEditor.BuildPlayerWindow/DefaultBuildMethods:BuildPlayer (UnityEditor.BuildPlayerOptions) 0x0000012782FABDB3 (Mono JIT Code) UnityEditor.BuildPlayerWindow:CallBuildMethods (bool,UnityEditor.BuildOptions) 0x0000012782FAB44B (Mono JIT Code) UnityEditor.BuildPlayerWindow:BuildPlayerAndRun (bool) 0x0000012782FA90D3 (Mono JIT Code) UnityEditor.BuildPlayerWindow:BuildPlayerAndRun () 0x000001273B895955 (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void (object,intptr,intptr,intptr) 0x00007FFD1900D6B0 (mono-2.0-bdwgc) [mini-runtime.c:2809] mono_jit_runtime_invoke 0x00007FFD18F92912 (mono-2.0-bdwgc) [object.c:2921] do_runtime_invoke 0x00007FFD18F9B96F (mono-2.0-bdwgc) [object.c:2968] mono_runtime_invoke 0x00007FF61BA51276 (Unity) CallStaticMonoMethod 0x00007FF61BA50EB9 (Unity) CallStaticMonoMethod 0x00007FF61BA50C41 (Unity) CallStaticMonoMethod 0x00007FF6199C2A4F (Unity) BuildPlayerWithLastSettings 0x00007FF6195D6A6C (Unity) MenuController::ExecuteMenuItem 0x00007FF6195D651B (Unity) MenuController::ExecuteMainMenuItem 0x00007FF61A814C25 (Unity) EditorApplication_CUSTOM_ExecuteMenuItem 0x0000012782FA8BBE (Mono JIT Code) (wrapper managed-to-native) UnityEditor.EditorApplication:ExecuteMenuItem (string) 0x0000012782FA8A8B (Mono JIT Code) UnityEditor.ShortcutManagement.MenuItemEntryDiscoveryInfo:<.ctor>b_7_0 (UnityEditor.ShortcutManagement.ShortcutArguments) 0x0000012782FA1FF1 (Mono JIT Code) UnityEditor.ShortcutManagement.Trigger:HandleKeyEvent (UnityEngine.Event,UnityEditor.ShortcutManagement.IContextManager) 0x000001274069FAA3 (Mono JIT Code) UnityEditor.ShortcutManagement.ShortcutController:HandleKeyEvent (UnityEngine.Event) 0x000001274069F60B (Mono JIT Code) UnityEditor.ShortcutManagement.ShortcutIntegration:EventHandler () 0x000001274069F33B (Mono JIT Code) UnityEditor.EditorApplication:Internal_CallGlobalEventHandler () 0x000001273B895955 (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void (object,intptr,intptr,intptr) 0x00007FFD1900D6B0 (mono-2.0-bdwgc) [mini-runtime.c:2809] mono_jit_runtime_invoke 0x00007FFD18F92912 (mono-2.0-bdwgc) [object.c:2921] do_runtime_invoke 0x00007FFD18F9B96F (mono-2.0-bdwgc) [object.c:2968] mono_runtime_invoke 0x00007FF61BA5AA2E (Unity) scripting_method_invoke 0x00007FF61BA5475D (Unity) ScriptingInvocation::Invoke 0x00007FF61BA4E745 (Unity) ScriptingInvocation::Invoke 0x00007FF618D73E4E (Unity) Scripting::UnityEditor::EditorApplicationProxy::Internal_CallGlobalEventHandler 0x00007FF6196B4E71 (Unity) CallGlobalInputEvent 0x00007FF61A1E35C0 (Unity) GUIView::ProcessEventMessages 0x00007FF61A1DB709 (Unity) GUIView::GUIViewWndProc 0x00007FFD5B175C7D (USER32) CallWindowProcW 0x00007FFD5B175672 (USER32) DispatchMessageW 0x00007FF61A1E0806 (Unity) MainMessageLoop 0x00007FF61A1EAAC8 (Unity) WinMain 0x00007FF61D209A32 (Unity) _scrt_common_main_seh 0x00007FFD5C597BD4 (KERNEL32) BaseThreadInitThunk 0x00007FFD5CA2CE51 (ntdll) RtlUserThreadStart
4.UnityEditor.BuildPlayerWindow+BuildMethodException: 2 errors at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x002bb] in :0 at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x00080] in :0 0x00007FF61BAE837C (Unity) StackWalker::GetCurrentCallstack 0x00007FF61BAEC331 (Unity) StackWalker::ShowCallstack 0x00007FF61A1BAE95 (Unity) GetStacktrace 0x00007FF61C76BE7E (Unity) DebugStringToFile 0x00007FF61BB47735 (Unity) DebugLogHandler_CUSTOM_Internal_Log 0x0000012782FEB3AB (Mono JIT Code) (wrapper managed-to-native) UnityEngine.DebugLogHandler:Internal_Log (UnityEngine.LogType,UnityEngine.LogOption,string,UnityEngine.Object) 0x0000012782FEB24B (Mono JIT Code) UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[]) 0x0000012782FEA90E (Mono JIT Code) UnityEngine.Logger:Log (UnityEngine.LogType,object) 0x0000012782FEA66A (Mono JIT Code) UnityEngine.Debug:LogError (object) 0x0000012782FABF1B (Mono JIT Code) UnityEditor.BuildPlayerWindow:CallBuildMethods (bool,UnityEditor.BuildOptions) 0x0000012782FAB44B (Mono JIT Code) UnityEditor.BuildPlayerWindow:BuildPlayerAndRun (bool) 0x0000012782FA90D3 (Mono JIT Code) UnityEditor.BuildPlayerWindow:BuildPlayerAndRun () 0x000001273B895955 (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void (object,intptr,intptr,intptr) 0x00007FFD1900D6B0 (mono-2.0-bdwgc) [mini-runtime.c:2809] mono_jit_runtime_invoke 0x00007FFD18F92912 (mono-2.0-bdwgc) [object.c:2921] do_runtime_invoke 0x00007FFD18F9B96F (mono-2.0-bdwgc) [object.c:2968] mono_runtime_invoke 0x00007FF61BA51276 (Unity) CallStaticMonoMethod 0x00007FF61BA50EB9 (Unity) CallStaticMonoMethod 0x00007FF61BA50C41 (Unity) CallStaticMonoMethod 0x00007FF6199C2A4F (Unity) BuildPlayerWithLastSettings 0x00007FF6195D6A6C (Unity) MenuController::ExecuteMenuItem 0x00007FF6195D651B (Unity) MenuController::ExecuteMainMenuItem 0x00007FF61A814C25 (Unity) EditorApplication_CUSTOM_ExecuteMenuItem 0x0000012782FA8BBE (Mono JIT Code) (wrapper managed-to-native) UnityEditor.EditorApplication:ExecuteMenuItem (string) 0x0000012782FA8A8B (Mono JIT Code) UnityEditor.ShortcutManagement.MenuItemEntryDiscoveryInfo:<.ctor>b_7_0 (UnityEditor.ShortcutManagement.ShortcutArguments) 0x0000012782FA1FF1 (Mono JIT Code) UnityEditor.ShortcutManagement.Trigger:HandleKeyEvent (UnityEngine.Event,UnityEditor.ShortcutManagement.IContextManager) 0x000001274069FAA3 (Mono JIT Code) UnityEditor.ShortcutManagement.ShortcutController:HandleKeyEvent (UnityEngine.Event) 0x000001274069F60B (Mono JIT Code) UnityEditor.ShortcutManagement.ShortcutIntegration:EventHandler () 0x000001274069F33B (Mono JIT Code) UnityEditor.EditorApplication:Internal_CallGlobalEventHandler () 0x000001273B895955 (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void (object,intptr,intptr,intptr) 0x00007FFD1900D6B0 (mono-2.0-bdwgc) [mini-runtime.c:2809] mono_jit_runtime_invoke 0x00007FFD18F92912 (mono-2.0-bdwgc) [object.c:2921] do_runtime_invoke 0x00007FFD18F9B96F (mono-2.0-bdwgc) [object.c:2968] mono_runtime_invoke 0x00007FF61BA5AA2E (Unity) scripting_method_invoke 0x00007FF61BA5475D (Unity) ScriptingInvocation::Invoke 0x00007FF61BA4E745 (Unity) ScriptingInvocation::Invoke 0x00007FF618D73E4E (Unity) Scripting::UnityEditor::EditorApplicationProxy::Internal_CallGlobalEventHandler 0x00007FF6196B4E71 (Unity) CallGlobalInputEvent 0x00007FF61A1E35C0 (Unity) GUIView::ProcessEventMessages 0x00007FF61A1DB709 (Unity) GUIView::GUIViewWndProc 0x00007FFD5B175C7D (USER32) CallWindowProcW 0x00007FFD5B175672 (USER32) DispatchMessageW 0x00007FF61A1E0806 (Unity) MainMessageLoop 0x00007FF61A1EAAC8 (Unity) WinMain 0x00007FF61D209A32 (Unity) _scrt_common_main_seh 0x00007FFD5C597BD4 (KERNEL32) BaseThreadInitThunk 0x00007FFD5CA2CE51 (ntdll) RtlUserThreadStart
【问题讨论】:
-
您是否执行了错误指示您执行的步骤?
Nevigate to 'Project Settings > Player > Android Tab > Publish Settings > Build', check 'Custom Gradle Template'. Then edit the generated file 'Assets/Plugins/Android/mainTemplate.gradle' by adding dependency 'com.android.tools.build:gradle:3.6.0.' -
它实际上不应该是必需的,对吧?我在其他不需要它的系统上有项目。我不想导出我的项目,我认为这是使用 gradle。菜鸟在这里
-
拥有自定义 gradle 模板与导出项目无关。它只是一个文本文件,您可以编辑它以添加依赖项等。似乎由于错误消息试图告诉您该做什么,您至少应该尝试一下。这似乎是他们预料到的问题。
-
需要吗?实际上我也这样做了,然后它要求我启用启动器 gradle 和其他一些东西,最终导致其他错误。哪个清单无法修补apk或其他东西(不确定)。
-
我在执行此操作时遇到合并清单错误。它要求检查主 gradle 模板和启动器 gradle 模板。
标签: c# android unity3d gradle build