Search code examples
androidandroid-proguardandroid-billing

Google Play Billing > Verify a purchase on a device > obfuscate with ProGuard


I wonder is the document put a wrong (opposite) meaning to use ProGuard?

enter image description here

Source: https://developer.android.com/google/play/billing/billing_library_overview

But my understanding is: I MUST NOT add this line into the ProGuard configuration file, does anyone also notice this? Or confirm it?

 -keep class com.android.vending.billing.**

Solution

  • The documentation is correct. I agree with you that it may look confusing when states that if you obfuscate your code then you must add such ProGuard rule to keep the vending.billing classes.

    To clarify its meaning, if you use obfuscation in your project, then in order to NOT break the billing library then such entry must be added to the ProGuard rules.

    This is required because though com.android.vending.billing isn't part of the billing library as it belongs to the Google Play Services, it is accessed through AIDL and obfuscating the project may remove/rename the vending references.