简体   繁体   中英

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

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

I'm learning the office sample code , but I find the sample code doesn't add it, you can see at here .

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. To include these extensions in your project, add the following dependencies to your app's build.gradle file

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". But you can of course, still write kotlin code without this extension lib.

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". If the need to use the extension presents itself later on, I would simply add it then.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM