美文网首页
Flutter调试报错Could not download解决不

Flutter调试报错Could not download解决不

作者: _Zero丶 | 来源:发表于2020-05-07 23:46 被阅读0次

    遇到这个问题所以记录下来,省得再次百度
    因为不能访问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.5.0'
        }
    }
    
    • 配置项目内的build.gradle文件


      20190809092234612.png
    buildscript {
        ext.kotlin_version = '1.2.71'
        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'
            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' }
        }
    }
    

    然后就可以运行调试了

    相关文章

      网友评论

          本文标题:Flutter调试报错Could not download解决不

          本文链接:https://www.haomeiwen.com/subject/bpptnhtx.html