这篇文章主要介绍了Linux下怎么部署Flutter开发框架的相关知识,内容详细易懂,操作简单快捷,具有一定借鉴价值,相信大家阅读完这篇Linux下怎么部署Flutter开发框架文章都会有所收获,下面我们一起来看看吧。
Flutter是Google使用Dart语言开发的移动应用开发框架,使用一套Dart代码就能快速构建高性能、高保真的iOS和Android应用程序,并且在排版、图标、滚动、点击等方面实现零差异。
版本信息
CentOS Linux release 7.7.1908 (Core)java version "1.8.0_241"git version 2.22.0Android SDK version 29.0.3Flutter version 1.12.13+hotfix.912345
安装git
yum -y install git unzip zip1
更新git版本
CentOS 7默认git版本是1.8.3 此版本git存在BUG会导致Flutter识别的版本变为0.0.0-unknown 需要升级一下git版本 git升级参考信息:
#yum -y install http://opensource.wandisco.com/centos/6/git/x86_64/wandisco-git-release-6-1.noarch.rpm#yum -y install http://opensource.wandisco.com/centos/7/git/x86_64/wandisco-git-release-7-1.noarch.rpmyum -y install http://opensource.wandisco.com/centos/7/git/x86_64/wandisco-git-release-7-2.noarch.rpmyum -y update git1234git version 2.22.01
安装JDK
tar -zxvf jdk-8u241-linux-x64.tar.gz -C /usr/local1
配置环境变量
/etc/profile添加
#自定义变量export JAVA_HOME=/usr/local/jdk1.8.0_241export ANDROID_HOME=/usr/local/sdkexport FLUTTER_HOME=/usr/local/flutterexport PUB_HOSTED_URL=https://pub.flutter-io.cnexport FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cnexport PATH=${JAVA_HOME}/bin:${ANDROID_HOME}/build-tools/29.0.3:${ANDROID_HOME}/cmdline-tools/latest/bin:${ANDROID_HOME}/platform-tools:${FLUTTER_HOME}/bin:${PATH}1234567source /etc/profile1
安装Android SDK
unzip commandlinetools-linux-6200805_latest.zip -d /usr/localmkdir -p /usr/local/sdkcd /usr/local/tools/bin./sdkmanager --list --sdk_root=/usr/local/sdk #显示可安装包./sdkmanager --install "platforms;android-29" --sdk_root=/usr/local/sdk #安装android-29./sdkmanager --install "platform-tools" --sdk_root=/usr/local/sdk #安装platform-tools./sdkmanager --install "build-tools;29.0.3" --sdk_root=/usr/local/sdk #安装build-tools./sdkmanager --install "cmdline-tools;latest" --sdk_root=/usr/local/sdk #安装cmdline-tools12345678
安装flutter
cd /usr/local#git clone https://github.com/flutter/flutter.git -b v1.14.4git clone https://github.com/flutter/flutter.git -b stable123
验证
flutter doctor -v1 Woah! You appear to be trying to run flutter as root. We strongly recommend running the flutter tool without superuser privileges. /?[✓] Flutter (Channel stable, v1.12.13+hotfix.9, on Linux, locale en_US.UTF-8) • Flutter version 1.12.13+hotfix.9 at /usr/local/flutter • Framework revision f139b11009 (13 days ago), 2020-03-30 13:57:30 -0700 • Engine revision af51afceb8 • Dart version 2.7.2[!] Android toolchain - develop for Android devices (Android SDK version 29.0.3) • Android SDK at /usr/local/sdk • Android NDK location not configured (optional; useful for native profiling support) • Platform android-29, build-tools 29.0.3 • ANDROID_HOME = /usr/local/sdk • Java binary at: /usr/local/jdk1.8.0_241/bin/java • Java version Java(TM) SE Runtime Environment (build 1.8.0_241-b07) ! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses[!] Android Studio (not installed) • Android Studio not found; download from https://developer.android.com/studio/index.html (or visit https://flutter.dev/setup/#android-setup for detailed instructions).[!] Connected device ! No devices available! Doctor found issues in 3 categories.
关于“Linux下怎么部署Flutter开发框架”这篇文章的内容就介绍到这里,感谢各位的阅读!相信大家对“Linux下怎么部署Flutter开发框架”知识都有一定的了解,大家如果还想学习更多知识,欢迎关注编程网行业资讯频道。