Android项目运行时出错
卡在Initializing gradle…
运行时会卡在Initializing gradle...
, 此时因为Android项目会用到Gradle
, 如果没有FQ,下载速度会非常慢, 此时我们可以在项目中的android/gradle/wrapper/gradle-wrapper.properties
中查看gradle
版本号以及地址, 我们可以手动下载然后解压到~/.gradle/wrapper/dists/
中。
卡在Running ‘gradle assembleDebug
运行时会卡在Running ‘gradle assembleDebug
, 因为Gradle的Maven仓库在国外, 可以使用阿里云的镜像地址。
* 修改项目中`android/build.gradle`文件
12345678910111213141516171819202122232425262728293031323334353637 |
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.2.1‘ }} 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‘ } }} rootProject.buildDir = ‘../build‘subprojects { project.buildDir = "${rootProject.buildDir}/${project.name}"}subprojects { project.evaluationDependsOn(‘:app‘)} task clean(type: Delete) { delete rootProject.buildDir} |
* 修改Flutter的配置文件, 该文件在`Flutter安装目录/packages/flutter_tools/gradle/flutter.gradle`
12345678910111213 |
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.2.1‘ }} |
flutter 卡在Running Gradle task 'assembleDebug'...
原文地址:https://www.cnblogs.com/wupeng88/p/11455874.html
时间: 2024-10-23 02:35:04