libgdx / gdx-pay

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

java.lang.NoSuchMethodError: org.onepf.oms.OpenIabHelper$Options$Builder.setStoreSearchStrategy #33

Closed raulpiiber closed 9 years ago

raulpiiber commented 9 years ago

I am trying to use gdx-pay in my game but I get error when I try to install PurchaseObserver: PurchaseSystem.install(new PurchaseObserver() {

The error I get is this: 03-13 23:05:11.953: E/AndroidRuntime(12352): java.lang.NoSuchMethodError: org.onepf.oms.OpenIabHelper$Options$Builder.setStoreSearchStrategy 03-13 23:05:11.953: E/AndroidRuntime(12352): at com.badlogic.gdx.pay.android.openiab.PurchaseManagerAndroidOpenIAB.install(PurchaseManagerAndroidOpenIAB.java:221) 03-13 23:05:11.953: E/AndroidRuntime(12352): at com.badlogic.gdx.pay.PurchaseSystem.install(PurchaseSystem.java:168)

I have added jar of gdx-pay-0.4.0 to core project, gdx-pay-android-0.4.0 and gdx-pay-android-openiab-0.4.0 to android project.

Can anyone help me out. What am I doing wrong?

noblemaster commented 9 years ago

Your configuration looks fine. It's a duplicate to https://github.com/libgdx/gdx-pay/issues/29.

Please really make sure you use the latest 0.4.0-SNAPSHOT release which should fix the issue!

raulpiiber commented 9 years ago

I am using these 0.4.0-SNAPSHOT files: https://oss.sonatype.org/#nexus-search;quick~gdx-pay https://oss.sonatype.org/#nexus-search;quick~gdx-pay-android https://oss.sonatype.org/#nexus-search;quick~gdx-pay-android-openiab

noblemaster commented 9 years ago

Oh, sorry; just realized that your problem is! You are using an old openiab.jar (we have upgraded to OpenIAB version 0.9.8.3)!

If you do not want to add the latest OpenIAB-jar manually every time, I suggest use our special library-build which has the latest OpenIAB inside. This isn't quite the proper way to go with maven/gradle, but I find it a lot more convenient if you don't use maven/gradle but add jars manually to your project: gdx-pay-android-openiab-0.4.0-SNAPSHOT-library.jar (contains the OpenIAB jar) Using the *-library.jar should fix your issues!

If you want to add the OpenIAB.jar manually to your project (what you are probably doing right now, use the following). Don't forget to also include the latest OpenIAB.jar (if you use maven/gradle it should all be done automatically for you though): gdx-pay-android-openiab-0.4.0-SNAPSHOT.jar (does NOT contain the OpenIAB jar)

raulpiiber commented 9 years ago

Yes, with library jar it's finally working. Thanks for helping me!

I know it's not a matter of this issue but if you have any simple example gdx-pay project that uses gradle, that would help me out a lot, cause I couldn't get it working that way.

noblemaster commented 9 years ago

Great!

re-gradle: I am using jars myself, however, this might help: http://www.badlogicgames.com/forum/viewtopic.php?f=11&t=16996

Also, you should be able to use the -library.jar using gradle as well. There was some earlier bug I fixed which prevented the -library.jar from working correctly with gradle. That way you wouldn't have to include the other dependent jars manually (and wouldn't have to worry about the correct version).