Mac下搭建Flutter 开发环境过程错误处理

执行 flutter doctor --android-licenses 后遇到如下错误:

Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
at com.android.repository.api.SchemaModuleSchemaModuleVersion.(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.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:73) at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:48) Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:602) at java.base/jdk.internal.loader.ClassLoadersAppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 5 more

解决方法如下:

  1. commad + , --> Appearance & Behavior --> System Settings --> Android SDK --> SDK Tools


    图1.png
  2. 选择 Android SDK Command-line Tools

  3. 点击 Apply 按钮

  4. 等更新完成后,再在 Terminal 中执行 flutter doctor --android-licenses

你可能感兴趣的:(Mac下搭建Flutter 开发环境过程错误处理)