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
To test your Google Play Billing Library integration using test tracks, do the following: Publish your app to a test track. Note that after you publish an app to a testing track, it can take a few hours for the app to be available for testers. Ensure each tester opts-in to your app's test.
On selecting the device, the uploaded/selected app will automatically open in the device in question. Alternatively, you can sign in to Google Play Store, download and install a published app and test its in-app purchase feature. Just pick the Install via Google Play Store option.
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
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
The following worked for me launching from my IDE (Android Studio)
1) Go to your https://play.google.com/apps/publish/ Under 'Developer' Account/Settings/Account details/License Testing
2) Add the 'Default Google Play' email address that corresponds with the device you are testing
Source: https://engineering.memrise.com/faster-in-app-billing-subscriptions-testing-8e68551b4e2f
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With