Android toolchain - develop for Android devices (Android SDK version 29.0.1) ✗ Android license status unknown. Try re-installing or updating your Android SDK Manager. See https://developer.android.com/studio/#downloads or visit https://flutter.dev/setup/#android-setup for detailed instructions.
以上是在flutter在输入flutter doctor报的安卓的错,在mac上
1.输入:
flutter doctor --android-licenses
报错:
A newer version of the Android SDK is required. To update, run: /Users/wenjianming/Library/Android/sdk/tools/bin/sdkmanager --update
2.根据提示输入:
/Users/wenjianming/Library/Android/sdk/tools/bin/sdkmanager --update
会输入提示:说明java的环境变量配置是有问题的
ERROR: JAVA_HOME is set to an invalid directory: Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home Please set the JAVA_HOME variable in your environment to match the location of your Java installation.
3.打开环境变量:
open -e .bash_profile
4.输入指令查看java安装的路径:(可选择,如果你知道的话,我输出的结果 /Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home)
/usr/libexec/java_home -V
5.输入配置环境内容:
JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home"
PATH="$JAVA_HOME/bin:$PATH"
CLASSPATH=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar:.
export JAVA_HOME
export PATH
export CLASSPATH
6.保存:
source ~/.bash_profile
7.最后:
flutter doctor --android-licenses
于是成功啦:
解决方法:
1.java的版本是1.8版本 Java -version 可查看
2.需要正确配置java的环境变量
还有别忘记android studio 安装插件,这里就不详细讲了,以上加粗和加下划线的是真正的步骤
需要说明的是:我刚开始下载的4 的版本找不到他们说的sdk内容,换了3.6版本的也还是不行,我放弃了。感谢那些少数人哈哈