unity3d 无法更新Android SDK包列表

4urapxun  于 2023-02-13  发布在  Android
关注(0)|答案(3)|浏览(354)

Everytime I try to open the Player settings, it will show only blank. And the error below will be shown in the console.
I have tried to follow this link: https://answers.unity.com/questions/1320634/unable-to-list-target-platforms-when-i-try-to-buil.html But still didn't work.
CommandInvokationFailure: Failed to update Android SDK package list. /Applications/Unity/Hub/Editor/2019.2.0b1/PlaybackEngines/AndroidPlayer/SDK/tools/bin/sdkmanager --list
stderr[ Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema at com.android.repository.api.SchemaModule$SchemaModuleVersion.(SchemaModule.java:156) at com.android.repository.api.SchemaModule.(SchemaModule.java:75) at com.android.sdklib.repository.AndroidSdkHandler.(AndroidSdkHandler.java:81) at com.android.sdklib.tool.SdkManagerCli.main(SdkManagerCli.java:103) Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) ... 4 more ] stdout[
] exit code: 1 UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <4e05d4950c734693b0d63f05223d7a90>:0) UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <4e05d4950c734693b0d63f05223d7a90>:0) UnityEditor.Android.SDKManager.UpdatePackagesList () (at <4e05d4950c734693b0d63f05223d7a90>:0) UnityEditor.Android.SDKManager.HighestVersionInstalled (UnityEditor.Android.SDKManager+Component tool) (at <4e05d4950c734693b0d63f05223d7a90>:0) UnityEditor.Android.AndroidPlatformIconProvider.GetCurrentSetAndroidSDKVersion () (at <4e05d4950c734693b0d63f05223d7a90>:0) UnityEditor.Android.AndroidPlatformIconProvider.UpdateSDKVersion () (at <4e05d4950c734693b0d63f05223d7a90>:0) UnityEditor.Android.AndroidPlatformIconProvider.get_targetSDKSupportsAdaptiveIcons () (at <4e05d4950c734693b0d63f05223d7a90>:0) UnityEditor.Android.PlayerSettingsEditorExtension.IconSectionGUI () (at <4e05d4950c734693b0d63f05223d7a90>:0) UnityEditor.PlayerSettingsEditor.IconSectionGUI (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.Modules.ISettingEditorExtension settingsExtension, System.Int32 sectionIndex) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Inspector/PlayerSettingsEditor/PlayerSettingsEditor.cs:803) UnityEditor.PlayerSettingsEditor.OnInspectorGUI () (at /Users/builduser/buildslave/unity/build/Editor/Mono/Inspector/PlayerSettingsEditor/PlayerSettingsEditor.cs:573) UnityEditor.AssetSettingsProvider.OnGUI (System.String searchContext) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Settings/Providers/AssetSettingsProvider.cs:94) UnityEditor.SettingsWindow.DrawControls () (at /Users/builduser/buildslave/unity/build/Editor/Mono/Settings/SettingsWindow.cs:322) UnityEditor.SettingsWindow.DrawSettingsPanel () (at /Users/builduser/buildslave/unity/build/Editor/Mono/Settings/SettingsWindow.cs:313) UnityEngine.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 parentTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout, UnityEngine.Rect layoutSize) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:281) UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
Before, I can see some options so that I can try to build.

bz4sfanl

bz4sfanl1#

我也遇到了这个问题。在我这么做之前什么都不起作用:

  • 转到Unity > Preferences,选择External Tools,取消选择所有内容
  • 关闭编辑器
  • 打开编辑器,重新启用您取消选择的所有内容
  • 点击播放强制刷新

然后重新构建,它会工作

sr4lhrrt

sr4lhrrt2#

我得到了同样的错误,并以不同的方式修复它。
此处可能的修复方法无法更新Android SDK包列表

h9a6wy2h

h9a6wy2h3#

我在将firebase SDK导入到Unity 2021.3.3f1中后也遇到了同样的错误。原来我的系统变量JAVA_HOME没有指向Unity使用的Java(这显然只会在与firebase结合时造成问题)。
为了解决这个问题我必须

  • 更改Windows 10 -〉设置-〉系统-〉编辑系统变量
  • 将“JAVA_HOME”的值更改为我的Unity Java版本:“F:\程序\统一\2021.3.3f1\编辑器\数据\播放引擎\安卓播放器\OpenJDK”
  • 重新启动我的计算机(使JAVA_HOME更改生效)
  • 在Unity中:点击资源-〉外部依赖管理器-〉Android -〉解决

不确定最后一步是否有必要。我尝试了很多方法(包括“重新生成项目文件”-从Unitys设置)

相关问题