Android studio 一直卡在Gradle:Build Running

  • Post author:
  • Post category:其他


问题:Android studio经常需要build调试app,但是有时会出现Gradle:Build Running中

解决方案:

1:在C:\Users\用户名.gradle新建一个文件gradle.properties,文件中添加内容


org.gradle.daemon=true

2:若添加后还是这样,转入build.gradle中,可以看到mavenCentral()拖慢,这就需要镜像了maven { url ‘http://maven.aliyun.com/nexus/content/groups/public/’ },如下


buildscript {
    repositories {
        google()
        jcenter()
        maven { url "https://jitpack.io" }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.6.2'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven { url "https://jitpack.io" }
//        mavenCentral()
        maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}



版权声明:本文为ware00原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。