1 在运行flutter doctor,出现以下错误:
[✓] Flutter (on Linux, locale en_US.UTF-8, channel master)
[✗] Android toolchain - develop for Android devices
✗ Unable to locate Android SDK.
Install Android Studio from:https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK components.
(or visithttps://flutter.io/setup/#android-setupfor detailed instructions).
If Android SDK has been installed to a custom location, set $ANDROID_HOME to that location.
[✓] Android Studio (version 3.0.0)
• Android Studio at /home/f/App/android-studio
• Gradle version 3.2
• Java version OpenJDK Runtime Environment (build 1.8.0_112-release-b06)
[✓] Connected devices(1 available)
解决方法:
添加环境变量ANDROID_HOME,把你android SDK的路径填上,重启电脑即可。
2 在输入flutter doctor检查一下,出现以下错误
解决方法:
输入 flutter doctor --android-licenses,接下来所有的输入 y 就可以了
3 第三次flutter doctor,发现问题解决了
4 如果你运行flutter项目的时候发现还提示你sdk未licenses,请检查项目中local.properties指定的sdk路径是否正确