查看 flutter 安装其它依赖项遇到的问题

运行 flutter doctor
Flutter 提供了一个 flutter doctor 命令协助我们安装 Flutter 的依赖。它会检查本地是否有 iOS 和 Android 的开发环境。如果检测到依赖缺失,它还会给出对应依赖的安装方法

运行以下命令查看是否需要安装其它依赖项来完成安装:

flutter doctor --verbose

简写

flutter doctor --v

该命令检查您的环境并在终端窗口中显示报告

$ flutter doctor -v
[✓] Flutter (Channel master, v0.5.7-pre.55, on Mac OS X 10.13.4 17E199, locale zh-Hans-CN)
    • Flutter version 0.5.7-pre.55 at /Users/iOSCMB/code/flutterSDK/flutter
    • Framework revision 06f63aaa5a (9 hours ago), 2018-07-04 16:55:22 -0700
    • Engine revision 21c7d6a5da
    • Dart version 2.0.0-dev.63.0.flutter-4c9689c1d2

[!] Android toolchain - develop for Android devices (Android SDK 28.0.1)
    • Android SDK at /Users/iOSCMB/AndroidStudio/SDK
    • Android NDK at /Users/iOSCMB/AndroidStudio/SDK/ndk-bundle
    • Platform android-28, build-tools 28.0.1
    • ANDROID_HOME = /Users/iOSCMB/AndroidStudio/SDK
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)
    ✗ Android license status unknown.

[!] iOS toolchain - develop for iOS devices (Xcode 9.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 9.3, Build version 9E145
    ✗ libimobiledevice and ideviceinstaller are not installed. To install, run:
        brew install --HEAD libimobiledevice
        brew install ideviceinstaller
    ✗ ios-deploy not installed. To install:
        brew install ios-deploy
    • CocoaPods version 1.5.3

[✓] Android Studio (version 3.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 26.0.1
    • Dart plugin version 173.4700
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)

[!] Connected devices
    ! No devices available

上面有三个地方打叉 一个感叹号,iOS 那部分按照提示做就ok,最下面感叹号电脑连接上 android 手机就好 ,下面记录一下 android 那部分
✗ Android license status unknown.
下面就是记录解决问题所执行的命令

$ flutter doctor --android-licenses
A newer version of the Android SDK is required. To update, run:
/Users/iOSCMB/AndroidStudio/SDK/tools/bin/sdkmanager --update
$ /Users/iOSCMB/AndroidStudio/SDK/tools/bin/sdkmanager --update
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
    at com.android.repository.api.SchemaModule$SchemaModuleVersion.<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:185)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
    ... 5 more
$ export SDKMANAGER_OPTS="--add-modules java.se.ee"
$ /Users/iOSCMB/AndroidStudio/SDK/tools/bin/sdkmanager --update
...
Accept? (y/N): y

再次检查一下 会出现下面的错误

$ flutter doctor -v

    ! Some Android licenses not accepted.  To resolve this, run: flutter doctor --android-licenses

然后

$ flutter doctor --android-licenses
 Accept? (y/N): y 

多输几次 y, 最后就是

 $ flutter doctor --verbose
[✓] Flutter (Channel master, v0.5.7-pre.55, on Mac OS X 10.13.4 17E199, locale zh-Hans-CN)
    • Flutter version 0.5.7-pre.55 at /Users/iOSCMB/code/flutterSDK/flutter
    • Framework revision 06f63aaa5a (14 hours ago), 2018-07-04 16:55:22 -0700
    • Engine revision 21c7d6a5da
    • Dart version 2.0.0-dev.63.0.flutter-4c9689c1d2

[✓] Android toolchain - develop for Android devices (Android SDK 28.0.1)
    • Android SDK at /Users/iOSCMB/AndroidStudio/SDK
    • Android NDK at /Users/iOSCMB/AndroidStudio/SDK/ndk-bundle
    • Platform android-28, build-tools 28.0.1
    • ANDROID_HOME = /Users/iOSCMB/AndroidStudio/SDK
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)
    • All Android licenses accepted.

[✓] iOS toolchain - develop for iOS devices (Xcode 9.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 9.3, Build version 9E145
    • ios-deploy 1.9.2
    • CocoaPods version 1.5.3

[✓] Android Studio (version 3.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 26.0.1
    • Dart plugin version 173.4700
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)

[✓] Connected devices (1 available)
    • MI 3016b56a0 • android-arm • Android 4.4.4 (API 19)
阅读更多
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/langzxz/article/details/80933515
文章标签: flutter
个人分类: flutter
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭
关闭