解决Flutter不能下载jar包问题

因为不可访问Google,所以直接下载Jar存在问题。

解决办法:

  • 更改Gradle仓库地址,使用阿里云加速:修改Flutter SDK安装目录下的\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:3.2.1'
        }
    }
    
  • 配置项目内的build.gradle文件
    解决Flutter不能下载jar包问题_第1张图片

    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:3.2.1'
        }
    }
    
    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'}
    
        }
    }
    

你可能感兴趣的:(Flutter)