可引用的链接,但对我不起作用:
我使用的是Android Studio 3.1.2
我正在尝试在此工作室中找到Google Play结算库,但未找到它。
另外我把库放在build.gradle(app)中:
implementation 'com.android.billingclient:billing:1.1'
Gradle Build成功但未在SDK Manager中显示Google Play结算库
以下是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:
你会发现现在通过Maven存储库可以使用Play Billing Library,这就是为什么你无法在你的sdk上找到它。
所以现在开始添加计费库作为依赖项。然后继续前进。
implementation 'com.android.billingclient:billing:1.1'
谷歌也提供了编码样本,以帮助您入门:
https://codelabs.developers.google.com/codelabs/play-billing-codelab/#0
此外,你也可以在这个答案中找到一些解释:
Why is the Google Play Billing Library not shown up in the SDK Manager?