首页 > 解决方案 > 有什么方法可以从顶级项目 gradle 中删除“classpath 'com.google.gms:google-services:4.2.0' 依赖项

问题描述

对于 firebase 设置,现在我的项目 gradle 具有 classpath 'com.google.gms:google-services:4.2.0'.

应用程序 gradle 包含apply plugin: 'com.google.gms.google-services'

我想将firebase相关代码移动到动态模块

所以我 apply plugin: 'com.google.gms.google-services'app Gradle搬到module Gradle

classpath 'com.google.gms:google-services:4.2.0'仍与整个项目有关。有没有办法从顶级项目 Gradle 中删除这种依赖关系?

标签: androidfirebasegradlegoogle-play-services

解决方案


只需buildscript在文件中添加块module/build.gradle

buildscript {
    repositories {
        //...
    }
    dependencies {
        //..
        classpath 'com.google.gms:google-services:4.2.0'
    }
}

推荐阅读