flutter 卡在Running Gradle task 'assembleDebug'...

Android項目運行時出錯

卡在Initializing gradle…

運行時會卡在Initializing gradle..., 此時由於Android項目會用到Gradle, 若是沒有FQ,下載速度會很是慢, 此時咱們能夠在項目中的android/gradle/wrapper/gradle-wrapper.properties中查看gradle版本號以及地址, 咱們能夠手動下載而後解壓到~/.gradle/wrapper/dists/中。android

卡在Running ‘gradle assembleDebug

運行時會卡在Running 'gradle assembleDebug, 由於Gradle的Maven倉庫在國外, 可使用阿里雲的鏡像地址。app

* 修改項目中`android/build.gradle`文件
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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`
1
2
3
4
5
6
7
8
9
10
11
12
13
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'
}
}
相關文章
相關標籤/搜索