简体   繁体   English

如何在Android中调试Inapp结算?

[英]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. 但是不幸的是,每次我尝试在USB调试模式下购买一些我的应用程序产品时,都会发生错误,告诉我该应用程序未签名 ,这就是为什么我什么都买不到的原因。 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. 当我将应用程序上传到Google Play上时,购买就可以了,因此显然可以解决问题,但这基本上不是我想要的。 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 1)将其上传到开发者控制台并等待2-3h
2) Download this app from play store 3) Connect app with android studio (only OPEN the source code) 2)从Play商店下载此应用3)将应用与android studio连接(仅打开源代码)
4) In android studio select "attach to debugger" 4)在android studio中选择“附加到调试器”

If you try to upload a debugable apk on google play you'll get this error: 如果您尝试在Google Play上上传可调试的APK,则会收到此错误:

Upload failed You uploaded a debuggable APK. 上传失败您上传了可调试的APK。 For security reasons you need to disable debugging before it can be published in Google Play. 出于安全原因,您需要先禁用调试功能,然后才能将其发布到Google Play中。

So you can't debug an app downloaded from google play. 因此,您无法调试从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: 相反,您可以将发行版本的不可破解版本上传到Google Play,然后使用以下命令构建同一应用的可调试发行版签名apk:

buildTypes {
    release {
       minifyEnabled false
       debuggable true
    }
}

install resulted apk through adb 通过adb安装结果apk

adb install -r name.of.your.apk

and then you can easily debug inapp billing app. 然后您可以轻松调试inapp结算应用。

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

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