libgdx / gdx-pay

A libGDX cross-platform API for InApp purchasing.
Apache License 2.0
225 stars 83 forks source link

PurchaseManager == null after switching from openIAB to the new googleplay jar (0.9.2) #103

Closed DavidBVal closed 8 years ago

DavidBVal commented 8 years ago

My code has been in production for many months using libgdx 1.6.1 and gdx-pay 0.4.0, I updated to gdx 1.9.1 and gdx-pay 0.9.2 without touching the purchases code(which is almost identical to the samples provided here). I add the jars manually as specified in the readme(not using gradle). I run my tests on device, exporting via eclipse a signed apk.

Everything works fine if I put gdx-pay-android-openiab-0.9.2-library.jar file in my android/libs folder, but when I try to switch to the gdx-pay-android-googleplay-0.9.2.jar, reflection stops working, and I get a null purchasemanager. No errors, nothing, just a null PurchaseManager

Is there anything additional I should modify to correctly initialize the new googleplay purchase manager?

DavidBVal commented 8 years ago

In the end I figured it out... it is no issue with gdx-pay, it was my oversight related to ProGuard.

Previously I was doing:

-keep public class com.badlogic.gdx.pay.android.openiab.PurchaseManagerAndroidOpenIAB {
  public protected *;
}

And the problem went away when I changed it to

-keep public class com.badlogic.gdx.pay.android.googleplay.AndroidGooglePlayPurchaseManager {
  public protected *;
}

Sorry!