ERROR: Failed to resolve: play-services-basement

ERROR: Failed to resolve: play-services-basement

我在 Android studio 中使用 firebase 工具向我的应用程序添加了 Firebase 消息传递,但我在我的应用程序中遇到了问题(添加 firebase 消息传递之前没有错误)。我当前在应用级别 gradle 中的设置:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.2"
    defaultConfig {
        applicationId "com.example.test"
        minSdkVersion 15
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'com.google.firebase:firebase-messaging:20.0.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
apply plugin: 'com.google.gms.google-services'

我已使用 项目结构 菜单将所有依赖项更新为最新版本。当我写这个问题时,firebase-messaging 的最新版本是 20.0.0,com.google.gms:google-services:4.3.2 所以问题不在于更新到最新版本。

这是项目级别 gradle:

buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.1'
        classpath 'com.google.gms:google-services:4.3.2'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven {
            url 'https://jitpack.io'
        }
        maven {
            url 'https://maven.google.com'
        }
    }
}

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

我检查过 but this is not my case as I have google() in repository before everything else. Also as I am working in androidx environment the case is not about support.v4

当我重建项目时,我得到这个错误:

ERROR: Failed to resolve: play-services-basement
Affected Modules: app

通过手动将以下行添加到 APP gradle 的依赖项中,错误消失了:

implementation 'com.google.android.gms:play-services-basement:17.1.1'

我想知道为什么程序员应该知道一个包的所有后台依赖项以及为什么它们没有自动实现。