1

I have my PROD app installed on my android phone with the package name "com.mycompany.app". however to develop and test my app I use the package name "com.mycompany.debugapp". in this way I can have the 2 app at the same time installed on my phone, the PROD version and the development version.

This was working great style I decide to implement billing :( from my development app, when I call querySkuDetailsAsync, it's return me an empty list :( I guess it's because I use com.mycompany.debugapp instead of com.mycompany.app. Is their any way to test billing services from my development app com.mycompany.debugapp?

zeus
  • 12,173
  • 9
  • 63
  • 184
  • 1
    AFAIK to test android billing you need that app on the play store. Cause you need to create items that can be bought. When you do `querySkuDetailsAsync`, It tries to get all the listed items from playstore. So in case of debug app there is no item. So the list is empty. You can use a proxy app like `Charles Proxy` to change the response of the api and put some items in the response. But I'll suggest you change the package name of debug build type and test you implementation. – Mostafa Monowar Oct 11 '20 at 22:57
  • The same question here : https://stackoverflow.com/questions/64301838/get-same-google-billing-skus-for-alterantive-app-package-names – from56 Oct 12 '20 at 11:32

1 Answers1

1

The problem you are facing with billing, is exactly as you thought due to the different package names. Regardless of whether your package names are similar, if they have at least 1 different character, then both the OS and Google treat them as two completely unrelated and different apps.

You should always use a fixed package name regardless the build type or any other requirement. The package name is your app's unique identifier and must be permanently fixed.

To differentiate debug/release builds use instead build variants.

If you need to test billing in debug, first publish a release build as internal test, then you will be able to test your debug builds. Notice it may take a few hours until you are able to start testing once published.

PerracoLabs
  • 16,449
  • 15
  • 74
  • 127
  • thanks perracLabs. however now I correct to use the same package name and I have this problem: https://stackoverflow.com/questions/64317544/the-item-that-you-were-attempting-to-purchase-could-not-be-found – zeus Oct 12 '20 at 12:23
  • The problem with this is that if you use the same package name for different environment then you can't have them side by side. For example a beta version pointing to staging and a production version both installed on the same device – Jonas Stawski Jan 31 '23 at 16:48
  • @JonasStawski You are right, is not possible to have them side by side, but keep in mind that the developer console supports app tracks which helps to at least have different downloable versions, yet only 1 version is allowed per device. When creating a track, Google gives you a unique link for the specific track that then you can give to test groups. But, the package remains the same, since a package name is the actual app unique identifier, and chanfing it means to define a complete different app. See next for app tracks: https://support.google.com/googleplay/android-developer/answer/9845334 – PerracoLabs Jan 31 '23 at 19:15