当前位置:   article > 正文

flutter项目运行时一直卡在Running Gradle task ‘assembleDebug‘解决办法_flutter running gradle task 'assembledebug'...

flutter running gradle task 'assembledebug'...

1.修改项目中的android/build.gradle,将google(),mavenCentral()替换为下面的代码

  1. maven { url 'https://maven.aliyun.com/repository/central/' }
  2. maven { url 'https://maven.aliyun.com/repository/public/' }
  3. maven { url 'https://maven.aliyun.com/repository/google/' }
  4. maven { url 'https://maven.aliyun.com/repository/gradle-plugin/' }

2.找到flutter的安装路径,找到packages\flutter_tools\gradle下的flutter.gradle文件,找到buildscript对象,对里面的repositories内容进行修改,换成以下代码

  1. buildscript {
  2. repositories {
  3. maven { url 'https://maven.aliyun.com/repository/central/' }
  4. maven { url 'https://maven.aliyun.com/repository/public/' }
  5. maven { url 'https://maven.aliyun.com/repository/google/' }
  6. maven { url 'https://maven.aliyun.com/repository/gradle-plugin/' }
  7. dependencies {
  8. /** When bumping, also update ndkVersion above, as well as the Android Gradle Plugin
  9. * version in ../lib/src/android/gradle_utils.dart.
  10. */
  11. classpath 'com.android.tools.build:gradle:7.3.0'
  12. }
  13. }

3.依然在flutter.gradle文件中使用“ctrl+F”搜索DEFAULT_MAVEN_HOST,修改为以下代码

private static final String DEFAULT_MAVEN_HOST = "https://storage.flutter-io.cn";

(本文的flutter版本为Flutter 3.10.6)

参考:

flutter运行一直显示Running Gradle task 'assembleDebug'.

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/笔触狂放9/article/detail/718202
推荐阅读
相关标签
  

闽ICP备14008679号