解决接入mPaas一直Starting Gradle Daemon...问题

1、新版开发工具

如若使用的是新版开发工具则在settings.gradle中加入

//        gradlePluginPortal()
//        google()
        maven { url 'https://maven.aliyun.com/repository/google' }
        maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
        maven { url 'https://maven.aliyun.com/repository/public' }
        maven { url 'https://maven.aliyun.com/repository/jcenter' }
//        mavenCentral()

一定要把 google()等注释掉如下

//        gradlePluginPortal()
//        google()

//   mavenCentral()

2.旧版的话在工程目录的build.gradle添加

//        gradlePluginPortal()
//        google()
        maven { url 'https://maven.aliyun.com/repository/google' }
        maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
        maven { url 'https://maven.aliyun.com/repository/public' }
        maven { url 'https://maven.aliyun.com/repository/jcenter' }
//        mavenCentral()

一定要把 google()等注释掉如下

//        gradlePluginPortal()
//        google()

//   mavenCentral()

3.最终settings.gradle文件

pluginManagement {
    repositories {

//        gradlePluginPortal()
//        google()
        maven { url 'https://maven.aliyun.com/repository/google' }
        maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
        maven { url 'https://maven.aliyun.com/repository/public' }
        maven { url 'https://maven.aliyun.com/repository/jcenter' }
//        mavenCentral()

        maven { url 'https://maven.aliyun.com/nexus/content/groups/public/' }
        maven { url 'https://maven.aliyun.com/nexus/content/repositories/jcenter' }
        maven { url 'https://maven.aliyun.com/nexus/content/repositories/google' }
        maven { url 'https://maven.aliyun.com/nexus/content/repositories/gradle-plugin' }
        maven { url 'https://jitpack.io' }
        maven { url 'https://maven.aliyun.com/repository/google' }
        maven { url 'https://maven.google.com' }
        maven {
            url "https://repo.eclipse.org/content/repositories/paho-snapshots/"
        }
        maven {
            url 'https://mvn.cloud.alipay.com/nexus/content/repositories/open/'
        }

        maven { url 'https://repo.spring.io/milestone' }
    }
}

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {

//        google()
        maven { url 'https://maven.aliyun.com/repository/google' }
        maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
        maven { url 'https://maven.aliyun.com/repository/public' }
        maven { url 'https://maven.aliyun.com/repository/jcenter' }
//        mavenCentral()

        maven { url 'https://maven.aliyun.com/nexus/content/groups/public/' }
        maven { url 'https://maven.aliyun.com/nexus/content/repositories/jcenter' }
        maven { url 'https://maven.aliyun.com/nexus/content/repositories/google' }
        maven { url 'https://maven.aliyun.com/nexus/content/repositories/gradle-plugin' }
        maven { url 'https://jitpack.io' }
        maven { url 'https://maven.aliyun.com/repository/google' }
        maven { url 'https://maven.google.com' }
        maven {
            url "https://repo.eclipse.org/content/repositories/paho-snapshots/"
        }
        maven {
            url 'https://mvn.cloud.alipay.com/nexus/content/repositories/open/'
        }

        maven { url 'https://repo.spring.io/milestone' }
    }
}
rootProject.name = "robotApp"
include ':app'
include ':mscV5PlusDemo'

4.原因分析

   由于

//        gradlePluginPortal()
//        google()

//  mavenCentral()

等的干扰会导致优先加载google的库,故需要注释掉,替换成阿里云的库。

你可能感兴趣的:(Android,android)