简体   繁体   English

当我将 Kotlin 用于 Google Play 时,是否需要添加实现 'com.android.billingclient:billing-ktx:2.1.0'?

[英]Do I need to add implementation 'com.android.billingclient:billing-ktx:2.1.0' when I use Kotlin for Google Play?

I have read the artical at https://developer.android.com/google/play/billing/billing_library_overview我已阅读https://developer.android.com/google/play/billing/billing_library_overview 上的文章

Do I need to add implementation 'com.android.billingclient:billing-ktx:2.1.0' when I use Kotlin for Google Play?当我将 Kotlin 用于 Google Play 时,是否需要添加implementation 'com.android.billingclient:billing-ktx:2.1.0'

I'm learning the office sample code , but I find the sample code doesn't add it, you can see at here .我正在学习office示例代码,但是我发现示例代码没有添加它,你可以在这里看到。

I will try and answer your question without really knowing that specific library.我会在不真正了解那个特定图书馆的情况下尝试回答你的问题。 The article states the following (which I assume you have read):这篇文章陈述了以下内容(我假设您已经阅读过):

If you're using Kotlin, the Play Billing Library KTX module contains Kotlin extensions and coroutines support that enable you to write idiomatic Kotlin in your Play Billing solution.如果您使用的是 Kotlin,Play Billing Library KTX 模块包含 Kotlin 扩展和协程支持,使您能够在 Play Billing 解决方案中编写惯用的 Kotlin。 To include these extensions in your project, add the following dependencies to your app's build.gradle file要在您的项目中包含这些扩展,请将以下依赖项添加到您的应用程序的 build.gradle 文件中

So that means that you will need the "billing-ktx" library/extension if you want to write "idiomatic Kotlin" using the extensions and coroutines, contained in "billing-ktx".所以这意味着如果您想使用“billing-ktx”中包含的扩展和协程编写“惯用的 Kotlin”,您将需要“billing-ktx”库/扩展。 But you can of course, still write kotlin code without this extension lib.但是你当然可以在没有这个扩展库的情况下编写 kotlin 代码。

If I was in your place (without much knowledge of the library), I would start out with the basic "com.android.billingclient:billing:2.1.0".如果我在你的位置(对图书馆没有太多了解),我会从基本的“com.android.billingclient:billing:2.1.0”开始。 If the need to use the extension presents itself later on, I would simply add it then.如果稍后需要使用扩展名,我会简单地添加它。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在 com.android.billingclient:billing-ktx 内部调度到 Dispatchers.ZCF51882F1C43AB9 中的 kotlin 扩展功能? - Do the kotlin extension functions in com.android.billingclient:billing-ktx dispatch to Dispatchers.IO internally? 无法使用com.android.billingclient:billing获得SkuDetail - cannot get SkuDetail using com.android.billingclient:billing 无法解析com.android.billingclient:billing:1.1 - Could not resolve com.android.billingclient:billing:1.1 无法解析com.android.billingclient:billing:1.0 - Failed to resolve com.android.billingclient:billing:1.0 无法解析com.android.billingclient:billing:dp-1 - Failed to resolve com.android.billingclient:billing:dp-1 我需要包括<uses-permission android:name="com.android.vending.BILLING" />当我使用 Google Play 结算库版本 5 时,在清单中? - Do I need to include <uses-permission android:name="com.android.vending.BILLING" /> in Manifest when I use Google Play Billing Library version 5? 无法在应用程序类型gradle文件中同时添加com.anjlab.android.iab.v3:library和com.android.billingclient:billing - Can't add both com.anjlab.android.iab.v3:library and com.android.billingclient:billing same time in the app type gradle file Android/Google Play:我真的需要自己的服务器来管理应用内计费订阅吗? - Android/Google Play: do I really need my OWN server to manage inapp billing subscriptions? 我是否需要在数据安全表单中披露 Google Play 计费库的使用情况? - Do I need to disclose use of Google Play billing library in the data safety form? 如何在 Android(Google Play 结算)中推迟订阅? - How do I defer a subscription in Android (Google Play Billing)?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM