Error to test subscriptions in signed debug app - android

I can't test subscriptions in my signed debug version, error:
Only works when I download the app straight from the store,
I have already done all these steps:
1 - The App is published in alpha;
2 - A test account is already registered on play console (Configurations);
3 - SKUs are already registered in play Console;
4 - Debug version code is same as store version;
5 - In Manifext android:debuggable="true" and in gradle release variant "debuggable true"
This is my first experience with Google Play Billing. I've been striving to follow the documentation steps https://developer.android.com/google/play/billing/billing_testing, however some steps are not very clear :(
I'd like some help understanding what I'm still doing wrong, as it won't be productive for me to test on the store app.

Related

How do I test the purchasing of Play subscriptions?

I have been trying to test the purchasing of Play store subscriptions on my device, but I have not succeeded despite following several step-by-step guides[1][2][3].
My ultmate aim is to test subscriptions on my USB connected device by building and installing the app with Android Studio. Unfortunately, it seems my only option right now is to to publish the app to the Alpha track on the Play Store, wait a few hours and download it every time I make a change.
The subscription products are queried successfully using BillingClient.querySkuDetailsAsync, but when I launch the billing flow (via BillingClient.launchBillingFlow) I see the following alert on the screen:
Error
This version of the application is not configured for billing through Google Play. Check the help centre for more information.
OK
I also see the following in the console:
W/ProxyBillingActivity: Activity finished with resultCode 0 and billing's responseCode: 5
W/BillingHelper: Couldn't find purchase lists, trying to find single data.
W/BillingHelper: Received a bad purchase data.
Couldn't find single purchase data as well.
The response code 5 indicates a developer error:
Invalid arguments provided to the API. This error can also indicate that the application was not correctly signed or properly set up for In-app Billing in Google Play, or does not have the necessary permissions in its manifest.
My app is published to Internal, Alpha and Beta release tracks with the same version name and version code as the locally built APK. In the Play console, I have created a License Tester and added it to the Alpha track's testers, then opted the tester in to the Alpha track via a link. On my device, I am logged in with the tester's Google account.
I have tried building an APK signed with the release certificate, with a matching version name & code to the APK published in the store. I was at first using the "Run" and "Debug" buttons in Android Studio, but discovered that they built an unsigned[7] APK no matter how I configured the signing configs. Instead, I build using the Build->Make Project menu item, and install the resulting signed APK using ADB[5]. The "Active Build Variant" is set to "Release".
It occurred to me that it may be impossible to sign a locally built APK with the same key as the APK distributed by the Play store, as my app has "Play App Signing" enabled (which causes Google to re-sign the APK using a different key, which is inaccessible to me). However, there is a thread on StackOverflow which suggests other have had success even when using Play App Signing[6].
I have also tried waiting several days between publishing a new build to the Alpha track and trying to purchase a subscription, as I read that the Play Store sometimes takes up to 24 hours to process builds.
I am using Android Studio 4.2 on MacOS 10.15.7, with a Samsung A5 phone for testing.
[1] Selling subscriptions
[2] Testing in-app purchases on Android
[3] Checklist on Stack overflow
[4] "Run" with signed APK
[5] Install an APK via ADB
[6] Testing In-App payments with Play App Signing enabled
[7] Verifying an APK is signed
Update 2022
I never found workaround for this on my Samsung A5 running Android 8. However, I purchased a Samsung A52 (running Android 12) and it does not exhibit this problem.
you need to increase the version and upload that version as beta publish.
mostly duplication
please check This version of the application is not configured for billing through Google Play
If two apps differ in the signing key or in the package, then Google Play considers them different applications
Both debug & release versions should use the same signing key, I can make test purchases while debugging via USB on Android Studio with no problemas
something like this on the app build.gradle :
buildTypes {
release {
signingConfig signingConfigs.mykey
debuggable false;
....
}
debug {
debuggable true
signingConfig signingConfigs.mykey
....
}
}
There's a utility called "lucky patcher" which modifies app code in order to allow for bypassing in app purchases (yes, it's used for piracy, but I'm pretty sure it's not piracy to bypass your own app). You could try using it to test your app.
And in case you haven't already, once you're done, protect against it by following this: Lucky patcher, how can I protect from it?

Android play console: internal testing version, close testing ? how does it works?

I already have a production app on play store,
now I have uploaded the next release version on internal testing track,
I have created a mailing list with team testers, but now all the tester of my team see the test version and they cannot choose between production version and test version. Is there a way to choose between the two version ?
How can the tester chooses between production app and the testing version ?
Moreover I'm wondering which is the difference between Android play console internal testing and closed testing ?
End users (or testers) cannot choose which version they want, they will always receive the APK/AAB with the highest versionCode that they are eligible for.
If users receive the APK from a testing track and want to go back to the production one, they have to opt out of the testing then reinstall the app (since Android will never downgrade an app) or wait for the next production push.

Error "Your transaction cannot be completed" when testing google play purchase

I am trying to purchase using a beta tester but i am getting this error.
This is an error that shows in google play window, after passing initial validations and after the user press subscribe button, so i guess it is not an code or configuration error.
Anyway i checked this link https://stackoverflow.com/a/22469253/2700303 and also downloaded the app from the store.
I check the "Learn more" link that comes with the error but nothing on that troubleshooting page helped.
The account used as a valid and active pay method.
I am running on a simulator, but google play comes with it for a reason, so i discard that also.
The rest of the suggestions say to use other device. My simulator is running API 28 so should be good enough.
In-app purchase must be tested with production build on real device.
Steps
Generate release build from Android studio.
Uninstall debug app from your device, or use adb uninstall.
adb uninstall {yourdomain}.{yourpackagename}
Install your release version to your device.
adb install app-release.apk
Update:
Check this answer for more details.
Update 2 :Please read more about Test Google Play Billing

GoogleSignInClient connects only when app's installed from Google Store

I am developing an Android game and currently trying to integrate with Google Play Game Services. I got stuck at the sign-on feature.
I use GoogleSignIn, getIntent, startActivityForResult etc. - all as described in Google manual. I think all's setup correctly, because when I build the app, deploy to Google Store (Internal Tests), and then I install it from there, all looks good: onActivityResult is called with result.isSuccess()==true and GoogleSignIn.getLastSignedInAccount returns != null.
The problem is when I try to run the app from Android Studio (or install APK manually). In this case, onActivityResult is called with SIGN_IN_REQUIRED and getLastSignedInAccount is always null. I am pretty sure all's setup fine (APK is signed, Android Studio is configured to sign the APKs etc.).
To ensure it's not about my Android Studio setup, I have installed manually exactly the same APK which I uploaded to Google Store but again - result is the same. When installed from Google Store, it's OK, when installed manually it's not (again: exactly the same APK binary).
Can you please help me? Theoretically I could continue development, but each I'd like to test something I'd need to upload new version to Google Store...
Thank you
Hmmm...its usual DEVELOPER ERROR, what you can do it..add your SHA1 code on firebase console, and it will work, it is showing this behaviour caus your signed key SHA1 is already added, that why it is working on release build and not on debug build, add your systems SHA1
How to get SHA1?
usually right side of android studio have a bar which says gradle click on it, expand it got to app>Tasks>android>signing report double click it...it will give you your SHA1, paste it on firebase console, wait for 1-2 minutes and check. It will work.

Issue with "Pre-Launch report" Google play store

I recently uploaded my app to the Google Play Store but got this pre-launch report in some devices :
Issue: Crash of app com.mypackage running instrumentation
ComponentInfo{com.google.android.apps.mtaas.crawler/android.support.test.runner.AndroidJUnitRunner}
How do solve it ?
I got the answer in Google play Console Help
As of October 2017, the pre-launch report uses a new crawler to provide a more comprehensive review of your app. To do so, the pre-launch report must temporarily re-sign your APK within our test environment.
If you notice any issues, you can switch back to the previous testing process (which doesn't require APK re-signing):
Sign in to your Play Console.
Select an app.
Select Release
management > Pre-launch report > Settings.
In the 'Pre-launch report version' section, move the Opt-out switch to the right until it turns blue.
I have tested and all test passed for all devices, and no more crash for running instrumentation.

Categories

Resources