简体   繁体   中英

How to debug inapp billing in android?

I would like to debug the whole in app billing process of my app. But unfortunatly, everytime i try to buy some products of my app when i am in usb debugging mode and error occurs, telling me, that the app is not signed and that's why i can't buy anything. When i upload the app on google play, the purchasing works, so it obviously solves the problem, but that's basically not what i want. So what do i have to do, to test the in app billing locally when i am debugging the app. is it even possible?

1) Upload it to developer console and wait 2-3h
2) Download this app from play store 3) Connect app with android studio (only OPEN the source code)
4) In android studio select "attach to debugger"

If you try to upload a debugable apk on google play you'll get this error:

Upload failed You uploaded a debuggable APK. For security reasons you need to disable debugging before it can be published in Google Play.

So you can't debug an app downloaded from google play. Instead you can upload the release undebuggable version to google play then build a debuggable release signed apk of the same app with:

buildTypes {
    release {
       minifyEnabled false
       debuggable true
    }
}

install resulted apk through adb

adb install -r name.of.your.apk

and then you can easily debug inapp billing app.

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