Deepin Linux上的Android+Flutter开发环境配置
在Linux上安装Flutter开发环境,官方教程参见Flutter Get Started,中国用户被墙需额外注意的官方教程参见Using Flutter in China。
到深度应用商店安装Android Studio及Genymotion,Android的SDK可指定到$HOME/android-sdk
在Android Studio中安装Flutter及Genymotion插件
在Android Studio->Settings->Genymotion指定Genymotion的安装路径/opt/genymotion
在Genymotion->Settings->ADB指定Android SDK Tools路径为$HOME/android-sdk
在Genymotion中选择安装一个模拟设备,如Samsung Galaxy S9
下载最新版的Flutter SDK并检测环境,Bash脚本如下:
# 切换到主目录
cd ~/
# dev为开发版、stable为稳定版
#git clone -b dev https://github.com/flutter/flutter.git
# 由于github克隆太慢,我Fork导入了一份到国内的gitee加快下载速度
#git clone -b dev https://github.com/liyujiang-gzu/flutter.git
#git clone -b dev https://gitee.com/li_yu_jiang/flutter.git
git clone -b dev https://gitee.com/li_yu_jiang/flutter.git
# 除了源码下载方式,也可以直接已发布的稳定版Flutter SDK包
# 切换到下载目录
#cd ~/Downloads/
# 下载Flutter SDK
#wget https://storage.googleapis.com/flutter_infra/releases/stable/linux/flutter_linux_v1.7.8+hotfix.4-stable.tar.xz
#wget https://storage.flutter-io.cn/flutter_infra/releases/stable/linux/flutter_linux_v1.7.8+hotfix.4-stable.tar.xz
# 切换回主目录
#cd ~/
# 解压Flutter SDK
#tar xf ~/Downloads/flutter_linux_v1.7.8+hotfix.4-stable.tar.xz
# 在.bashrc中添加Android及Flutter的环境变量,若没有安装深度编辑器,可以使用vim、nano等
deepin-editor ~/.bashrc
#export JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64"
#export ANDROID_HOME="$HOME/android-sdk"
#export FLUTTER_HOME="$HOME/flutter"
#export PUB_HOSTED_URL=https://pub.flutter-io.cn
#export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
#export PATH="$PATH:$JAVA_HOME/bin:$ANDROID_HOME/platform-tools:$FLUTTER_HOME/bin"
# 让刚刚加入的环境变量立即生效
source ./.bashrc
# 查看环境变量具体的值
echo PWD=$PWD
echo HOME=$HOME
echo JAVA_HOME=$JAVA_HOME
echo ANDROID_HOME=$ANDROID_HOME
echo FLUTTER_HOME=$FLUTTER_HOME
echo PUB_HOSTED_URL=$PUB_HOSTED_URL
echo FLUTTER_STORAGE_BASE_URL=$FLUTTER_STORAGE_BASE_URL
echo PATH=$PATH
# 验证可用性
java -version
which adb
which flutter
#自动安装并校验Flutter开发环境
flutter doctor --android-licenses
flutter doctor --verbose