flutter运行失败

被墙了导致无法运行项目,报错如下:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':flutter_custom_dialog:javaPreCompileDebug'.
> Could not resolve all files for configuration ':flutter_custom_dialog:debugCompileClasspath'.
   > Could not download flutter_embedding_debug.jar (io.flutter:flutter_embedding_debug:1.0.0-540786dd51f112885a89792d678296b95e6622e5)
      > Could not get resource 'https://storage.googleapis.com/download.flutter.io/io/flutter/flutter_embedding_debug/1.0.0-540786dd51f112885a89792d678296b95e6622e5/flutter_embedding_debug-1.0.0-540786dd51f112885a89792d678296b95e6622e5.jar'.
         > Could not GET 'https://storage.googleapis.com/download.flutter.io/io/flutter/flutter_embedding_debug/1.0.0-540786dd51f112885a89792d678296b95e6622e5/flutter_embedding_debug-1.0.0-540786dd51f112885a89792d678296b95e6622e5.jar'.
            > Connect to storage.googleapis.com:443 [storage.googleapis.com/172.217.160.112] failed: Connection timed out: connect

* Try:

我的解决方法:

1.将Android目录下的build.gradle中的allprojects中添加一句


 .........

allprojects {
    repositories {
        google()
        jcenter()
        maven {url 'https://dl.bintray.com/jetbrains/anko'}

    }
}

...........

2.将fluttersdk安装目录下的flutter.gradle也加上这个

位置:\packages\flutter_tools\gradle\flutter.gradle

buildscript {
    repositories {
        google()
        jcenter()
        maven {url 'https://dl.bintray.com/jetbrains/anko'}

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.0'
    }
}

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值