Flutter 环境安装
可参照官网:https://flutterchina.club/get-started/install/Linux环境第一步:安装fluttersudo snap install flutter --classic第二步:flutter环境校验flutter doctorflutter doctor -vflutter doctor --android-licenses (如果提示Android
可参照官网:https://flutterchina.club/get-started/install/
Linux环境
第一步:安装flutter
sudo snap install flutter --classic
第二步:flutter环境校验
flutter doctor
flutter doctor -v
flutter doctor --android-licenses (如果提示Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses)<一直Y>
第三步:插件安装
安装开发工具(以AS为例),安装完开发工具后,请在【file】–【settings】–【Plugins】中搜索Flutter、Dart两个插件进行安装
第四步:运行DEMO
新建demo,并运行demo(此时可能会出现一直在Running Gradle task ‘assembleDebug’)
备注:
如果出现一直Running Gradle task 'assembleDebug’的情况,请修改两个文件
1> 修改项目中的Android目录下的build.gradle文件内容,注释google()、 jcenter()如下:
buildscript {
ext.kotlin_version = '1.3.72'
repositories {
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/jcenter' }
maven { url 'http://maven.aliyun.com/nexus/content/groups/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/jcenter' }
maven { url 'http://maven.aliyun.com/nexus/content/groups/public' }
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
2> 修改安装flutter环境目录中…/packages/flutter_tools/gradle/flutter.gradle文件中注释google()、 jcenter(),更改成如下:
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/jcenter' }
maven { url 'http://maven.aliyun.com/nexus/content/groups/public' }
注意:/packages/flutter_tools/gradle/flutter.gradle文件中的dependencies中的gradle版本应该与Android项目中的build.gradle文件中版本一致
更多推荐
所有评论(0)