运行flutter应用时,长时间卡在Running Gradle task 'assembleDebug'...

运行时会卡在Running 'gradle assembleDebug, 因为Gradle的Maven仓库在国外, 可以使用阿里云的镜像地址

1 打开项目:

运行flutter应用时,长时间卡在Running Gradle task 'assembleDebug'..._第1张图片

buildscript {  
  ext.kotlin\_version = '1.3.50'  
  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'  
  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' }  
 }}

2 打开flutter目录

D:\WWW\flutter\packages\flutter_tools\gradle\flutter.gradle

运行flutter应用时,长时间卡在Running Gradle task 'assembleDebug'..._第2张图片

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

再重新运行flutter app ,就可以成功了
运行flutter应用时,长时间卡在Running Gradle task 'assembleDebug'..._第3张图片

你可能感兴趣的:(flutter)