问题
Flutter项目安装到Android手机一直显示在assembledebug
原因
网络不好,gradle依赖下载不下来
解决方案
修改如下的文件
gradle-wrapper.properties
使用腾讯提供的gradle镜像下载
distributionUrl=https://mirrors.cloud.tencent.com/gradle/gradle-7.5-all.zip
build.gradle文件
将图片中标记出来的地方改为使用下面的镜像地址
repositories {
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/jcenter' }
maven { url 'https://maven.aliyun.com/repository/public/' }
maven { url 'https://maven.aliyun.com/repository/central' }
maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
maven {url 'https://maven.aliyun.com/nexus/content/groups/public/'}
maven { url 'https://maven.aliyun.com/nexus/content/groups/public' }
mavenCentral()
google()
}
allprojects {
repositories {
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/jcenter' }
maven { url 'https://maven.aliyun.com/repository/public/' }
maven { url 'https://maven.aliyun.com/repository/central' }
maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
maven {url 'https://maven.aliyun.com/nexus/content/groups/public/'}
mavenCentral()
google()
}
}
在上面两步做完以后,理论上就可以正常安装了。
参考
- Flutter项目启动一直卡在Running Gradle task ‘assembleDebug‘问题解决
- flutter run长时间卡在Running Gradle task ”assembleDebug“…