Is it possible to debug locally Google Play’s in-app billing in Android Studio?

EDIT: This is now superseded by the newly accepted answer.

In essence, in-app billing payments can only be tested with a release-signed apk (the one we upload to Google Play Console).

Here are some steps that got me attached to a signed apk with Android Studio:

I’m on Windows. It helps having adb.exe in the PATH, for me that’s:

C:\Users{your-username}\AppData\Local\Android\sdk\platform-tools

  1. In Google Play Console, ensure the app is published (< is a one-time manual step after its initially processed) in alpha or beta channel and you have a licensed test gmail account (from the Account Settings section) that is also in the list of alpha/beta testers and is not the owner of the app account. This account is the only account on the device. Release the apk and ensure it all works from an installed version from the Play Store.
  2. Have these settings:
    In AndroidManifest.xml under application node
android:debuggable="true"
tools:ignore="HardcodedDebugMode"

Note:
Propably, you need to add: xmlns:tools="http://schemas.android.com/tools" property to your manifest tag. It may look like:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
 package="your.package"
 xmlns:tools="http://schemas.android.com/tools">

And in your build.gradle file under android > buildTypes > release, add:

debuggable true

  1. Generate a signed APK from Android Studio

  2. Attach your device for USB debugging. Remove current install:

adb uninstall {yourdomain}.{yourpackagename}

  1. Install it (from the release path)

adb install app-release.apk

  1. Open the app on the device. From Android Studio’s Run menu, last option is “Attach debugger to Android Process” – select your device. You are now debugging.

NB for in-app billing the build number needs to match the one currently published on Play Store

Leave a Comment