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

2023-12-14 22:36:32

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的库,故需要注释掉,替换成阿里云的库。

文章来源:https://blog.csdn.net/shi450561200/article/details/135004873
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。