尝试在Unity中构建项目时发生Gradle错误

vsnjm48y  于 2023-10-19  发布在  其他
关注(0)|答案(1)|浏览(355)

我试图构建我的项目以将其导出到另一台计算机,但失败了。这是调试日志:

Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details
> Task :launcher:preBuild UP-TO-DATE
> Task :unityLibrary:preBuild UP-TO-DATE
> Task :launcher:preReleaseBuild UP-TO-DATE
> Task :unityLibrary:preReleaseBuild UP-TO-DATE
> Task :unityLibrary:compileReleaseAidl NO-SOURCE
> Task :unityLibrary:mergeReleaseJniLibFolders UP-TO-DATE
> Task :launcher:generateReleaseBuildConfig UP-TO-DATE
> Task :launcher:compileReleaseAidl NO-SOURCE
> Task :launcher:javaPreCompileRelease UP-TO-DATE
> Task :launcher:generateReleaseResValues UP-TO-DATE
> Task :launcher:createReleaseCompatibleScreenManifests UP-TO-DATE
> Task :launcher:extractDeepLinksRelease UP-TO-DATE
> Task :launcher:extractProguardFiles UP-TO-DATE
> Task :unityLibrary:mergeReleaseNativeLibs UP-TO-DATE
> Task :launcher:mergeReleaseJniLibFolders UP-TO-DATE
> Task :unityLibrary:stripReleaseDebugSymbols UP-TO-DATE
> Task :unityLibrary:copyReleaseJniLibsProjectAndLocalJars UP-TO-DATE
> 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:parseReleaseLocalResources UP-TO-DATE
> Task :launcher:checkReleaseDuplicateClasses UP-TO-DATE
> Task :unityLibrary:processReleaseManifest UP-TO-DATE
> Task :launcher:desugarReleaseFileDependencies UP-TO-DATE
> Task :launcher:mergeExtDexRelease UP-TO-DATE
> Task :launcher:mergeReleaseShaders UP-TO-DATE
> Task :launcher:compileReleaseShaders NO-SOURCE
> Task :launcher:generateReleaseAssets UP-TO-DATE
> Task :launcher:processReleaseJavaRes NO-SOURCE
> Task :launcher:collectReleaseDependencies UP-TO-DATE
> Task :unityLibrary:generateReleaseRFile UP-TO-DATE
> Task :launcher:sdkReleaseDependencyData UP-TO-DATE
> Task :launcher:validateSigningRelease UP-TO-DATE
> Task :launcher:writeReleaseAppMetadata UP-TO-DATE
> Task :launcher:writeReleaseSigningConfigVersions UP-TO-DATE
> Task :unityLibrary:extractReleaseAnnotations UP-TO-DATE
> Task :unityLibrary:javaPreCompileRelease UP-TO-DATE

> Task :unityLibrary:compileReleaseJavaWithJavac FAILED
29 actionable tasks: 1 executed, 28 up-to-date

0x00007ff6373e8e4d (Unity) StackWalker::GetCurrentCallstack
0x00007ff6373eddf9 (Unity) StackWalker::ShowCallstack
0x00007ff6383bb121 (Unity) GetStacktrace
0x00007ff638a7d922 (Unity) DebugStringToFile
0x00007ff6363397f6 (Unity) DebugLogHandler_CUSTOM_Internal_Log
0x000001c85db9f8ea (Mono JIT Code) (wrapper managed-to-native) UnityEngine.DebugLogHandler:Internal_Log (UnityEngine.LogType,UnityEngine.LogOption,string,UnityEngine.Object)
0x000001c85db9f75b (Mono JIT Code) UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
0x000001c85db9ebde (Mono JIT Code) UnityEngine.Logger:Log (UnityEngine.LogType,object)
0x000001c85db9e87a (Mono JIT Code) UnityEngine.Debug:LogError (object)
0x000001c85db9db13 (Mono JIT Code) UnityEditor.Android.GradleInvokationException:ParseAndShowException ()
0x000001c85ec5c99b (Mono JIT Code) UnityEditor.Android.PostProcessor.PostProcessRunner:RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext)
0x000001c85db3d8f3 (Mono JIT Code) UnityEditor.Android.PostProcessAndroidPlayer:PostProcess (UnityEditor.Modules.BuildPostProcessArgs,AndroidPlayerBuildProgram.Data.AndroidPlayerBuildProgramOutput)
0x000001c85dac3023 (Mono JIT Code) UnityEditor.Android.AndroidBuildPostprocessor:PostProcess (UnityEditor.Modules.BuildPostProcessArgs,UnityEditor.BuildProperties&)
0x000001c85dac1c8d (Mono JIT Code) UnityEditor.PostprocessBuildPlayer:Postprocess (UnityEditor.BuildTargetGroup,UnityEditor.BuildTarget,int,string,string,string,int,int,UnityEditor.BuildOptions,UnityEditor.RuntimeClassRegistry,UnityEditor.Build.Reporting.BuildReport)
0x000001c85dac234f (Mono JIT Code) (wrapper runtime-invoke) <Module>:runtime_invoke_void_int_int_int_object_object_object_int_int_int_object_object (object,intptr,intptr,intptr)
0x00007fff078ee0d4 (mono-2.0-bdwgc) mono_jit_runtime_invoke (at C:/build/output/Unity-Technologies/mono/mono/mini/mini-runtime.c:3445)
0x00007fff0782eb74 (mono-2.0-bdwgc) do_runtime_invoke (at C:/build/output/Unity-Technologies/mono/mono/metadata/object.c:3066)
0x00007fff0782ed0c (mono-2.0-bdwgc) mono_runtime_invoke (at C:/build/output/Unity-Technologies/mono/mono/metadata/object.c:3113)
0x00007ff637307bc4 (Unity) scripting_method_invoke
0x00007ff6372e6844 (Unity) ScriptingInvocation::Invoke
0x00007ff638df23b1 (Unity) CallMono
0x00007ff638dfb267 (Unity) PostprocessPlayer
0x00007ff638df5653 (Unity) DoBuildPlayer_PostBuild
0x00007ff638df374e (Unity) DoBuildPlayer
0x00007ff638de7085 (Unity) BuildPlayer
0x00007ff636b8432f (Unity) BuildPipeline::BuildPlayerInternalNoCheck
0x00007ff636914ffc (Unity) BuildPipeline_CUSTOM_BuildPlayerInternalNoCheck
0x000001c85d89bce8 (Mono JIT Code) (wrapper managed-to-native) UnityEditor.BuildPipeline:BuildPlayerInternalNoCheck (string[],string,string,UnityEditor.BuildTargetGroup,UnityEditor.BuildTarget,int,UnityEditor.BuildOptions,string[],bool)
0x000001c85d89a763 (Mono JIT Code) UnityEditor.BuildPlayerWindow/DefaultBuildMethods:BuildPlayer (UnityEditor.BuildPlayerOptions)
0x000001c85d88db1b (Mono JIT Code) UnityEditor.BuildPlayerWindow:CallBuildMethods (bool,UnityEditor.BuildOptions)
0x000001c85d7ce91b (Mono JIT Code) UnityEditor.BuildPlayerWindow:GUIBuildButtons (UnityEditor.Modules.IBuildWindowExtension,bool,bool,bool,UnityEditor.Build.BuildPlatform,UnityEditor.Modules.IBuildPostprocessor)
0x000001c85d7b657b (Mono JIT Code) UnityEditor.BuildPlayerWindow:ShowBuildTargetSettings ()
0x000001c85d78d7d3 (Mono JIT Code) UnityEditor.BuildPlayerWindow:OnGUI ()
0x000001c84659caaa (Mono JIT Code) UnityEditor.HostView:InvokeOnGUI (UnityEngine.Rect)
0x000001c84659c533 (Mono JIT Code) UnityEditor.DockArea:DrawView (UnityEngine.Rect)
0x000001c84657251b (Mono JIT Code) UnityEditor.DockArea:OldOnGUI ()
0x000001c6abf87371 (Mono JIT Code) UnityEngine.UIElements.IMGUIContainer:DoOnGUI (UnityEngine.Event,UnityEngine.Matrix4x4,UnityEngine.Rect,bool,UnityEngine.Rect,System.Action,bool)
0x000001c8464e80b3 (Mono JIT Code) UnityEngine.UIElements.IMGUIContainer:HandleIMGUIEvent (UnityEngine.Event,UnityEngine.Matrix4x4,UnityEngine.Rect,System.Action,bool)
0x000001c85d740fdb (Mono JIT Code) UnityEngine.UIElements.IMGUIContainer:HandleIMGUIEvent (UnityEngine.Event,System.Action,bool)
0x000001c85d740cc3 (Mono JIT Code) UnityEngine.UIElements.IMGUIContainer:HandleIMGUIEvent (UnityEngine.Event,bool)
0x000001c85d72f2eb (Mono JIT Code) UnityEngine.UIElements.IMGUIContainer:SendEventToIMGUIRaw (UnityEngine.UIElements.EventBase,bool,bool)
0x000001c85d738793 (Mono JIT Code) UnityEngine.UIElements.IMGUIContainer:SendEventToIMGUI (UnityEngine.UIElements.EventBase,bool,bool)
0x000001c8025fae23 (Mono JIT Code) UnityEngine.UIElements.IMGUIContainer:ProcessEvent (UnityEngine.UIElements.EventBase)
0x000001c8025f9e83 (Mono JIT Code) UnityEngine.UIElements.CallbackEventHandler:HandleEvent (UnityEngine.UIElements.EventBase)
0x000001c8025f932c (Mono JIT Code) UnityEngine.UIElements.CallbackEventHandler:HandleEventAtCurrentTargetAndPhase (UnityEngine.UIElements.EventBase)
0x000001c8025f87fb (Mono JIT Code) UnityEngine.UIElements.CallbackEventHandler:HandleEventAtTargetPhase (UnityEngine.UIElements.EventBase)
0x000001c85d731213 (Mono JIT Code) UnityEngine.UIElements.MouseCaptureDispatchingStrategy:DispatchEvent (UnityEngine.UIElements.EventBase,UnityEngine.UIElements.IPanel)
0x000001c8047fbc76 (Mono JIT Code) UnityEngine.UIElements.EventDispatcher:ApplyDispatchingStrategies (UnityEngine.UIElements.EventBase,UnityEngine.UIElements.IPanel,bool)
0x000001c8047fa50b (Mono JIT Code) UnityEngine.UIElements.EventDispatcher:ProcessEvent (UnityEngine.UIElements.EventBase,UnityEngine.UIElements.IPanel)
0x000001c8025c035b (Mono JIT Code) UnityEngine.UIElements.EventDispatcher:ProcessEventQueue ()
0x000001c8025bfc2b (Mono JIT Code) UnityEngine.UIElements.EventDispatcher:OpenGate ()
0x000001c8025bf9ab (Mono JIT Code) UnityEngine.UIElements.EventDispatcherGate:Dispose ()
0x000001c8047fb4e3 (Mono JIT Code) UnityEngine.UIElements.EventDispatcher:ProcessEvent (UnityEngine.UIElements.EventBase,UnityEngine.UIElements.IPanel)
0x000001c8047f945b (Mono JIT Code) UnityEngine.UIElements.EventDispatcher:Dispatch (UnityEngine.UIElements.EventBase,UnityEngine.UIElements.IPanel,UnityEngine.UIElements.DispatchMode)
0x000001c8047f8f6b (Mono JIT Code) UnityEngine.UIElements.BaseVisualElementPanel:SendEvent (UnityEngine.UIElements.EventBase,UnityEngine.UIElements.DispatchMode)
0x000001c83eaa0c63 (Mono JIT Code) UnityEngine.UIElements.UIElementsUtility:DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel)
0x000001c806e5f0d3 (Mono JIT Code) UnityEngine.UIElements.UIElementsUtility:UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (int,intptr,bool&)
0x000001c806e5ea44 (Mono JIT Code) UnityEngine.UIElements.UIEventRegistration:ProcessEvent (int,intptr)
0x000001c806e5e73b (Mono JIT Code) UnityEngine.UIElements.UIEventRegistration/<>c:<.cctor>b__1_2 (int,intptr)
0x000001c806e5e1e5 (Mono JIT Code) UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
0x000001c806e5e426 (Mono JIT Code) (wrapper runtime-invoke) <Module>:runtime_invoke_void_int_intptr_intptr& (object,intptr,intptr,intptr)
0x00007fff078ee0d4 (mono-2.0-bdwgc) mono_jit_runtime_invoke (at C:/build/output/Unity-Technologies/mono/mono/mini/mini-runtime.c:3445)
0x00007fff0782eb74 (mono-2.0-bdwgc) do_runtime_invoke (at C:/build/output/Unity-Technologies/mono/mono/metadata/object.c:3066)
0x00007fff0782ed0c (mono-2.0-bdwgc) mono_runtime_invoke (at C:/build/output/Unity-Technologies/mono/mono/metadata/object.c:3113)
0x00007ff637307bc4 (Unity) scripting_method_invoke
0x00007ff6372e6844 (Unity) ScriptingInvocation::Invoke
0x00007ff6372e1495 (Unity) ScriptingInvocation::Invoke<void>
0x00007ff63743356a (Unity) Scripting::UnityEngine::GUIUtilityProxy::ProcessEvent
0x00007ff637e26518 (Unity) GUIView::ProcessRetainedMode
0x00007ff6383ed414 (Unity) GUIView::OnInputEvent
0x00007ff637e26463 (Unity) GUIView::ProcessInputEventFromAPI
0x00007ff637e26338 (Unity) GUIView::ProcessInputEvent
0x00007ff6383ee21c (Unity) GUIView::ProcessEventMessages
0x00007ff6383e7fa5 (Unity) GUIView::GUIViewWndProc
0x00007fff939fe858 (USER32) CallWindowProcW
0x00007fff939fe299 (USER32) DispatchMessageW
0x00007ff6383c1693 (Unity) MainMessageLoop
0x00007ff6383c6910 (Unity) WinMain
0x00007ff6397b133e (Unity) __scrt_common_main_seh
0x00007fff93bb7614 (KERNEL32) BaseThreadInitThunk
0x00007fff950626b1 (ntdll) RtlUserThreadStart

Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
C:\Users\guill\Omni Android\Library\Bee\Android\Prj\Mono2x\Gradle\unityLibrary\src\main\java\com\unity\androidnotifications\UnityNotificationManager.java:164: error: cannot find symbol
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU)
                                                        ^
  symbol:   variable TIRAMISU
  location: class VERSION_CODES
C:\Users\guill\Omni Android\Library\Bee\Android\Prj\Mono2x\Gradle\unityLibrary\src\main\java\com\unity\androidnotifications\UnityNotificationManager.java:165: error: cannot find symbol
            permissionGranted = mContext.checkCallingOrSelfPermission(Manifest.permission.POST_NOTIFICATIONS) == PackageManager.PERMISSION_GRANTED;
                                                                                         ^
  symbol:   variable POST_NOTIFICATIONS
  location: class permission
Note: C:\Users\guill\Omni Android\Library\Bee\Android\Prj\Mono2x\Gradle\unityLibrary\src\main\java\com\unity3d\player\UnityPlayerActivity.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
2 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':unityLibrary:compileReleaseJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

CommandInvokationFailure: Gradle build failed. 
D:\UNITY\2022.3.5f1\Editor\Data\PlaybackEngines\AndroidPlayer\OpenJDK\bin\java.exe -classpath "D:\UNITY\2022.3.5f1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-7.2.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "assembleRelease"

该项目在编辑器上运行良好,播放选项没有错误。尝试了很多东西,但没有什么可以帮助。谷歌和stackoverflow似乎没有答案。
有什么建议吗
我尝试删除项目目录中的库文件夹,尝试重新导入资源并修复依赖关系问题。

ruyhziif

ruyhziif1#

看起来你需要将gradle的compileSdkVersion设置为33 (或更高?)
移动的服务器需要SDK 33来编译代码。默认情况下,Unity将compile SDK设置为与目标SDK相同。这可以通过使用自定义gradle模板进行更改:

  • 在播放器设置中启用自定义主Gradle模板(发布)
  • 在文本编辑器中打开模板文件,将compileSdkVersion修改为33,而不是默认的TARGETSDKVERSION

来源:https://issuetracker.unity3d.com/issues/unitynotificationmanager-dot-java-164-error-cannot-find-symbol-error-when-targeting-sdk-api-lower-than-33-with-mobile-notifications

相关问题