Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 863
Anton Kizema Avatar asked Oct 18 '22 18:10

Anton Kizema


2 Answers

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")
         }
    }
}
like image 159
Siarhei Kavaleuski Avatar answered Oct 21 '22 04:10

Siarhei Kavaleuski


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
    }
like image 30
Maxim G Avatar answered Oct 21 '22 04:10

Maxim G