今天在运行flutter doctor 时报了一个错误
MacBook-Pro-2:~ liuliuwenchao$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 1.22.3, on Mac OS X 10.15.7 19H2, locale
zh-Hans-CN)
[!] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
! Some Android licenses not accepted. To resolve this, run: flutter doctor
--android-licenses
[✓] Xcode - develop for iOS and macOS (Xcode 12.2)
[!] Android Studio (version 2020.3)
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
✗ Unable to find bundled Java version.
[✓] VS Code (version 1.58.2)
[!] Connected device
! Error: iPhone is not connected. Xcode will continue when iPhone is
connected. (code -13)
! Doctor found issues in 3 categories.
! Some Android licenses not accepted. To resolve this, run: flutter doctor
如他所说的 运行命令
flutter doctor --android-licenses
然后又报错
MacBook-Pro-2:~ liuliuwenchaoSchemaModuleVersion.<init>(SchemaModule.java:156)
at com.android.repository.api.SchemaModule.<init>(SchemaModule.java:75)
at com.android.sdklib.repository.AndroidSdkHandler.<clinit>(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:582)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:190)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499)
... 5 more
Exception in thread "main" java.lang.NoClassDefFoundError
有一些文件异常了,重新下载一下,输入以下命令
/Users/Applications/AndroidStudio/SDK/tools/bin/sdkmanager --update
然后在 flutter doctor
出现警告
MacBook-Pro-2:~ liuliuwenchao$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 1.22.3, on Mac OS X 10.15.7 19H2, locale
zh-Hans-CN)
[!] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
! Some Android licenses not accepted. To resolve this, run: flutter doctor
--android-licenses
[✓] Xcode - develop for iOS and macOS (Xcode 12.2)
[!] Android Studio (version 2020.3)
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
✗ Unable to find bundled Java version.
[✓] VS Code (version 1.58.2)
[!] Connected device
! Error: iPhone is not connected. Xcode will continue when iPhone is
connected. (code -13)
! Doctor found issues in 3 categories.
再按他的提示一步步同意协议