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?
-
1You need to upload (at least a beta version) to Google Play to use it, however you should be able to debug locally if you already did that. Are you testing while having at least one APK there?– Victor SantiagoJul 3, 2016 at 5:55
-
Yes that's the point, i have already uploaded my app on play store and it's available since 2 months with the in app functionality. But i can't debug my inapp billing code with usb debugging using android studio.– Thomas RichterJul 3, 2016 at 11:53
2 Answers
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.
-
1Interessting. For me as the developer, the most appropriate solution would be a direct way to debug this, without having to wait until the new update is published to the store. But thanks anyway, i didn't know this way either :) Oct 14, 2016 at 5:50
-
-
I tried reinstalling the debuggable release signed apk and I got an error: "adb: failed to install releases/consumer/release/app-consumer-arm64-v8a-release.apk: Failure [INSTALL_FAILED_UPDATE_INCOMPATIBLE: Package <com.xpto.appname> signatures do not match previously installed version; ignoring!]". Should I uninstall and try again? Jan 3, 2020 at 16:21
-
Uninstall first and then install the debuggable signed apk did worked. Jan 3, 2020 at 16:27
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"