Flutter开发环境配置

Posted 夜辉疾风

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Flutter开发环境配置相关的知识,希望对你有一定的参考价值。

Windows下用android Studio开发Flutter项目的环境配置

//下载flutter SDK
git clone -b master https://github.com/flutter/flutter.git
//配置环境变量,改为国内镜像
FLUTTER_HOME:D:\\FlutterSdk

path:%FlutterSdk%\\bin

key:PUB_HOSTED_URL  
value:https://pub.flutter-io.cn

key:FLUTTER_STORAGE_BASE_URL 
value:https://storage.flutter-io.cn
cmd:
flutter --version
flutter --doctor
//修改Flutter Sdk中的配置文件
//E:\\FlutterSDK\\packages\\flutter_tools\\gradle\\flutter.gradle

buildscript 
    repositories 
        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' 
    
    dependencies 
        classpath 'com.android.tools.build:gradle:4.0.1'
    

class FlutterPlugin implements Plugin<Project> 
   // private static final String DEFAULT_MAVEN_HOST = "https://storage.googleapis.com";
    private static final String DEFAULT_MAVEN_HOST = "https://storage.flutter-io.cn/download.flutter.io";
	
project.rootProject.allprojects 
	repositories 
    	maven 
 	       url repository
        
		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' 
    

//项目中android项目配置
//在project:build.gradle:
buildscript 
    ext.kotlin_version = '1.4.0'
    repositories 
		//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' 
		
	dependencies 
         //修改自己的gradle版本
         classpath 'com.android.tools.build:gradle:4.0.1'
         //修改最新kotlin版本
         classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    

allprojects 
    repositories 
		//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' 
    


//在app:build.gradle
android
    compileSdkVersion 30//sdk版本号
    ndkVersion '21.3.6528147'//ndk版本号

defaultConfig 
    minSdkVersion 16
    targetSdkVersion 30//sdk版本号

                        
//修改gradle版本:
//gradle/wrapper/gradle-wrapper.properties
distributionUrl=https\\://services.gradle.org/distributions/gradle-6.6.1-all.zip//修改成自己本地有的版本

以上是关于Flutter开发环境配置的主要内容,如果未能解决你的问题,请参考以下文章

Flutter开发环境配置

Flutter开发环境配置

Flutter开发环境配置(MAC版)

vscode flutter 环境搭建

Mac环境下的flutter配置及安装

配置Flutter开发环境