I am getting this error testing in-app subscription products locally.
authentication is required. you need to sign in to your google account
I was able to check the the inventory for the product but shouldn't I also be able to purchase it?
There are a number of posts about why this error might occur which I thought were addressed:
Is the only way to test actual purchases via the beta/alpha channels - not straight from android studio. This post suggests it possible (see screen shot)
http://developer.android.com/google/play/billing/billing_testing.html#billing-testing-test
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
AndroidManifest.xml
under application
nodeandroid: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
Generate a signed APK from Android Studio
Attach your device for USB debugging. Remove current install:
adb uninstall {yourdomain}.{yourpackagename}
adb install app-release.apk
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