找不到图书馆 Google 播放计费或额外内容

Can't find library Google play billing or Extras

可参考链接但对我不起作用:

我正在使用 Android Studio 3.1.2

我试图在此 Studio 中找到 Google Play Billing Library,但没有找到。

我也将库放入 build.gradle(app):

implementation 'com.android.billingclient:billing:1.1'

Gradle 构建成功但未在 SDK 管理器中显示 Google Play Billing Library

见下方 SDK Manager 对话框截图:

下面是build.gradle(app):

    // Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.2'


        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

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

在您的sdk中找不到计费库的原因是因为根据google official blog:

you will find that Play Billing Library is available through Maven repository now that's why you can't find it on your sdk.

所以现在您首先将计费库添加为依赖项。然后继续前进。

implementation 'com.android.billingclient:billing:1.1'

并且 google 提供了编码示例以帮助您开始:

https://codelabs.developers.google.com/codelabs/play-billing-codelab/#0

Github Link

此外,您也可以在这个答案中找到一些解释:

Why is the Google Play Billing Library not shown up in the SDK Manager?