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

只愿长相守 提交于 2019-11-26 17:16:01

问题


I'd like to make an android application with in app purchases, I read often that I have to download the Google Play Billing Library from SDK Manager

(e.g. http://www.techotopia.com/index.php/An_Android_Studio_Google_Play_In-app_Billing_Tutorial#Installing_the_Google_Play_Billing_Library ), but I can't find it there. Does I need this file? If yes, how can I manage that it is shown to me? On the developers.android webside is nothing written of the Google Play Billing Library, but if I copy their sample code to my project, I get many errors. I searched for Example projects for example on github, I found one, but when I run it, the app crashes. Is there any sample project, I think this would solve my problems?

THANKS !!!


回答1:


Checking the offical blog:

Play Billing Library is available through Maven repository

Just add:

dependencies {
    ...
    compile 'com.android.billingclient:billing:1.0'
}

You can find more details about the library in the official doc.




回答2:


You are referring to the old Google Play Billing library (v3), which if you really want to implement you can find it as part of the TrivialDrive demo app below. You can copy parts that you need (aidl, util) and change your app as per demo sample.
https://github.com/googlesamples/android-play-billing/tree/master/TrivialDrive

~~~

The new version of Play Billing library v1.0 is covered by Garbriele Mariotti's answer (above). If you happen to use a platform that doesn't support Maven, Gradle or AARs I will be making it available soon (UPDAT to follow) as an Eclipse based project that you may be able to import into your IDE the same way you wanted to import the old library downloaded through SDK Manager (which probably doesn't include it anymore as they dev team doens't want you to use it anymore).

If you just want to download it and look at it, you can download it from here:
https://google.bintray.com/play-billing/com/android/billingclient/billing/1.0/

~~~

Google Play Billing 1.0 library for Eclipse available from here:
https://github.com/dandar3/android-google-services-billing/tree/1.0




回答3:


Play Billing Library is available through Maven repository.

Add in top level build.gradle file

    buildscript {

    mavenCentral()     
    }

    ................
    allprojects {

    repositories {

    mavenCentral()
       }
    }

Add dependency into module level build.gradle file.

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

Then After implement in app billing sample example into your project.

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

This link you can find sample code of in app billing example of google

https://github.com/googlesamples/android-play-billing



来源:https://stackoverflow.com/questions/46391543/why-is-the-google-play-billing-library-not-shown-up-in-the-sdk-manager

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!