Google billing does not work with applicationIdSuffix ".debug" for debug builds
Asked Answered
S

2

6

I implemented google billing functional in my app. All works, but when i added flag applicationIdSuffix ".debug" to build.gradle, billing would not work for debug builds, but my tester really needs it. Is there any option to make it work, not removing the flag?

Spiroid answered 16/1, 2017 at 12:7 Comment(3)
Your apk now has a different applicationId, so it won't be able to access billing setup in market for your original applicationIdSwollen
Exactly, but there might be some trick, maybe someone knows? I tried to deceive inappbillingservice, passing wrong pack name (like production pack name), but it returned me an error. Maybe there is some another option to do thisSpiroid
@AntonKizema You find a solution? I'm facing the same issue now.Luxuriate
M
2

When you use applicationIdSuffix you actually changing your applicationId. You can't use In-App Purchases with applicationId that is different from applicationId in your application added to Google Play Console.

If you want to debug purchases you need to sign your debug APK with same key that you use for release APK.

Easiest way is to add these values to the gradle.properties file:

com.yourdomain.yourapp.store=PATH_TO_KEYSTORE_FILE
com.yourdomain.yourapp.storepassword=PASSWORD_FOR_KEYSTORE_FILE
com.yourdomain.yourapp.alias=KEYSTORE_ALIAS
com.yourdomain.yourapp.aliaspassword=PASSWORD_FOR_KEYSTORE_ALIAS

And then you can add these lines to your build.gradle:

android {
    ...
    signingConfigs {
         debug {
             storeFile file(project.property("com.yourdomain.yourapp.store"))
             storePassword project.property("com.yourdomain.yourapp.storepassword")
             keyAlias project.property("com.yourdomain.yourapp.alias")
             keyPassword project.property("com.yourdomain.yourapp.aliaspassword")
         }
    }
}
Mongoloid answered 7/9, 2019 at 15:36 Comment(0)
B
1

Check requirements.

For your tester apk can be debuggable:

    signedDebug {
        minifyEnabled false
        debuggable true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        signingConfig signingConfigs.release
    }
Brunhilda answered 20/1, 2017 at 6:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.