在macOS上对Flutter的安装配置

参考学习:

Cookbook: Useful Flutter samples : https://flutter.dev/docs/cookbook

报错误:Exception: idevice_id returned an error:

解决办法:

https://www.jianshu.com/p/1ec36db7d551
brew update
brew uninstall --ignore-dependencies libimobiledevice
brew uninstall --ignore-dependencies usbmuxd
brew install --HEAD usbmuxd
brew unlink usbmuxd
brew link usbmuxd
brew install --HEAD libimobiledevice
$ idevice_id -l
20a548dc87a87ecddf7ab3975a4b5f3395ac132

brew install ideviceinstaller ios-deploy

解决:

$ sudo mkdir /usr/local/Frameworks
$ sudo chown $(whoami):admin /usr/local/Frameworks
成功:
$ brew link python3
Linking /usr/local/Cellar/python3/3.6.3... 1 symlinks created

问题:mac catlina无法打开”idevice_id”,因为无法确认开发者的身份。

如果默认没有这个选项怎么办?不要慌,打开终端Terminal,粘贴复制执行以下命令即可:

sudo spctl --master-disable  

sudo xattr -r -d com.apple.quarantine /Applications/i4Tools.app

macOS设置

Failed to run sdkmanager –list (Android SDK) with Java 9:https://stackoverflow.com/questions/47150410/failed-to-run-sdkmanager-list-android-sdk-with-java-9
运行sdkmanager --update 报错的解决方案:https://blog.laji.cx/post/deal-with-android-sdkmanager-update-error/

Flutter android sdkmanager — update with Jdk 12:https://medium.com/@parsher/flutter-android-sdkmanager-update-with-jdk-12-ad8098165472
下载jar包

cd $ANDROID_SDK_ROOT/tools
mkdir jaxb_lib
wget http://central.maven.org/maven2/javax/activation/activation/1.1.1/activation-1.1.1.jar -O jaxb_lib/activation.jar
wget http://central.maven.org/maven2/org/glassfish/jaxb/jaxb-xjc/2.3.2/jaxb-xjc-2.3.2.jar -O jaxb_lib/jaxb-xjc.jar
wget http://central.maven.org/maven2/org/glassfish/jaxb/jaxb-core/2.3.0.1/jaxb-core-2.3.0.1.jar -O jaxb_lib/jaxb-core.jar
wget http://central.maven.org/maven2/org/glassfish/jaxb/jaxb-jxc/2.3.2/jaxb-jxc-2.3.2.jar -O jaxb_lib/jaxb-jxc.jar
wget http://central.maven.org/maven2/javax/xml/bind/jaxb-api/2.3.1/jaxb-api-2.3.1.jar -O jaxb_lib/jaxb-api.jar
wget https://repo1.maven.org/maven2/com/sun/xml/bind/jaxb-impl/2.3.2/jaxb-impl-2.3.2.jar -O jaxb_lib/jaxb-impl.jar
wget https://repo1.maven.org/maven2/com/sun/istack/istack-commons-runtime/3.0.8/istack-commons-runtime-3.0.8.jar -O jaxb_lib/istack-commons-runtime.jar

在tools/bin目录下,编辑sdkmanager , avdmanager,并添加环境变量

CLASSPATH=$CLASSPATH:$APP_HOME/jaxb_lib/jaxb-api.jar:$APP_HOME/jaxb_lib/jaxb-core.jar:$APP_HOME/jaxb_lib/jaxb-impl.jar:$APP_HOME/jaxb_lib/jaxb-jxc.jar:$APP_HOME/jaxb_lib/jaxb-xjc.jar:$APP_HOME/jaxb_lib/activation.jar:$APP_HOME/jaxb_lib/istack-commons-runtime.jar

再执行

/Users/luowei/Library/Android/sdk/tools/bin/sdkmanager --update

然后下载license

flutter doctor --android-licenses

最后

flutter doctor

版权所有,转载请注明出处 luowei.github.io.