onepf / OpenIAB

Open In-App Billing for Google Play, SlideMe, Amazon Store, Nokia Store, Samsung Apps, Yandex.Store, Appland, Aptoide, AppMall and Fortumo.
http://onepf.org/openiab/
Apache License 2.0
475 stars 171 forks source link

Amazon crash when querying inventory and find previous purchase #390

Closed appfamily closed 9 years ago

appfamily commented 9 years ago

I have a single IAP, to unlock the full game. I can buy it successfully.

If I uninstall and re-install the game, and return to my purchasing scene, it crashes during inventory query with the following backtrace (first amazon app tester throws an error, included):

11-16 21:35:18.662: W/AmazonAppTester/PurchaseUpdatesCommandHandler(16228): Error parsing offset: 11-16 21:35:18.662: W/AmazonAppTester/PurchaseUpdatesCommandHandler(16228): java.lang.NumberFormatException: Invalid long: "" 11-16 21:35:18.662: W/AmazonAppTester/PurchaseUpdatesCommandHandler(16228): at java.lang.Long.invalidLong(Long.java:124) 11-16 21:35:18.662: W/AmazonAppTester/PurchaseUpdatesCommandHandler(16228): at java.lang.Long.parseLong(Long.java:345) 11-16 21:35:18.662: W/AmazonAppTester/PurchaseUpdatesCommandHandler(16228): at java.lang.Long.parseLong(Long.java:318) 11-16 21:35:18.662: W/AmazonAppTester/PurchaseUpdatesCommandHandler(16228): at com.amazon.sdktestclient.iap.command.PurchaseUpdatesCommandHandler.parseOffset(PurchaseUpdatesCommandHandler.java:122) 11-16 21:35:18.662: W/AmazonAppTester/PurchaseUpdatesCommandHandler(16228): at com.amazon.sdktestclient.iap.command.PurchaseUpdatesCommandHandler.executeRequest(PurchaseUpdatesCommandHandler.java:49) 11-16 21:35:18.662: W/AmazonAppTester/PurchaseUpdatesCommandHandler(16228): at com.amazon.sdktestclient.iap.command.IapCommandHandler.execute(IapCommandHandler.java:59) 11-16 21:35:18.662: W/AmazonAppTester/PurchaseUpdatesCommandHandler(16228): at com.amazon.sdktestclient.command.CommandBroker.onHandleIntent(CommandBroker.java:30) 11-16 21:35:18.662: W/AmazonAppTester/PurchaseUpdatesCommandHandler(16228): at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65) 11-16 21:35:18.662: W/AmazonAppTester/PurchaseUpdatesCommandHandler(16228): at android.os.Handler.dispatchMessage(Handler.java:102) 11-16 21:35:18.662: W/AmazonAppTester/PurchaseUpdatesCommandHandler(16228): at android.os.Looper.loop(Looper.java:145) 11-16 21:35:18.662: W/AmazonAppTester/PurchaseUpdatesCommandHandler(16228): at android.os.HandlerThread.run(HandlerThread.java:61) 11-16 21:35:18.702: W/dalvikvm(20259): threadid=1: thread exiting with uncaught exception (group=0x41634d58) 11-16 21:35:18.702: E/AndroidRuntime(20259): FATAL EXCEPTION: main 11-16 21:35:18.702: E/AndroidRuntime(20259): Process: com.appfamily.PegPuzzle2Trial, PID: 20259 11-16 21:35:18.702: E/AndroidRuntime(20259): java.lang.NoSuchMethodError: com.amazon.device.iap.model.Product.getPrice 11-16 21:35:18.702: E/AndroidRuntime(20259): at org.onepf.oms.appstore.AmazonAppstoreBillingService.a(SourceFile:299) 11-16 21:35:18.702: E/AndroidRuntime(20259): at org.onepf.oms.appstore.AmazonAppstoreBillingService.onProductDataResponse(SourceFile:282) 11-16 21:35:18.702: E/AndroidRuntime(20259): at com.amazon.device.iap.internal.a.c$1.run(SourceFile:216) 11-16 21:35:18.702: E/AndroidRuntime(20259): at android.os.Handler.handleCallback(Handler.java:755) 11-16 21:35:18.702: E/AndroidRuntime(20259): at android.os.Handler.dispatchMessage(Handler.java:95) 11-16 21:35:18.702: E/AndroidRuntime(20259): at android.os.Looper.loop(Looper.java:145) 11-16 21:35:18.702: E/AndroidRuntime(20259): at android.app.ActivityThread.main(ActivityThread.java:5262) 11-16 21:35:18.702: E/AndroidRuntime(20259): at java.lang.reflect.Method.invokeNative(Native Method) 11-16 21:35:18.702: E/AndroidRuntime(20259): at java.lang.reflect.Method.invoke(Method.java:515) 11-16 21:35:18.702: E/AndroidRuntime(20259): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:826) 11-16 21:35:18.702: E/AndroidRuntime(20259): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:642) 11-16 21:35:18.702: E/AndroidRuntime(20259): at dalvik.system.NativeStart.main(Native Method)

My setup:

RomanZhilich commented 9 years ago

Do you by any chance use proguard with your application? It looks like you might've forgotten to update you rules for amazon, check here for more details.

appfamily commented 9 years ago

I use Proguard, but I have updated the config according to the wiki. If Proguard was stripping out Amazon I don't think I would have been able to make the purchase in the first place, right?

Could there be any relation to the earlier error? Other users have reported the same thing (https://forums.developer.amazon.com/forums/message.jspa?messageID=13094).

I disabled Proguard, by commenting out the entry in project.properties. The backtrace is the same, just not obfuscated:

11-17 20:53:24.690: E/AndroidRuntime(7181): Process: com.appfamily.PegPuzzle2Trial, PID: 7181 11-17 20:53:24.690: E/AndroidRuntime(7181): java.lang.NoSuchMethodError: com.amazon.device.iap.model.Product.getPrice 11-17 20:53:24.690: E/AndroidRuntime(7181): at org.onepf.oms.appstore.AmazonAppstoreBillingService.getSkuDetails(AmazonAppstoreBillingService.java:299) 11-17 20:53:24.690: E/AndroidRuntime(7181): at org.onepf.oms.appstore.AmazonAppstoreBillingService.onProductDataResponse(AmazonAppstoreBillingService.java:282) 11-17 20:53:24.690: E/AndroidRuntime(7181): at com.amazon.device.iap.internal.a.c$1.run(SandboxRequestHandler.java:216) 11-17 20:53:24.690: E/AndroidRuntime(7181): at android.os.Handler.handleCallback(Handler.java:755) 11-17 20:53:24.690: E/AndroidRuntime(7181): at android.os.Handler.dispatchMessage(Handler.java:95) 11-17 20:53:24.690: E/AndroidRuntime(7181): at android.os.Looper.loop(Looper.java:145) 11-17 20:53:24.690: E/AndroidRuntime(7181): at android.app.ActivityThread.main(ActivityThread.java:5262) 11-17 20:53:24.690: E/AndroidRuntime(7181): at java.lang.reflect.Method.invokeNative(Native Method) 11-17 20:53:24.690: E/AndroidRuntime(7181): at java.lang.reflect.Method.invoke(Method.java:515) 11-17 20:53:24.690: E/AndroidRuntime(7181): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:826) 11-17 20:53:24.690: E/AndroidRuntime(7181): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:642) 11-17 20:53:24.690: E/AndroidRuntime(7181): at dalvik.system.NativeStart.main(Native Method) 11-17 20:53:24.730: E/InputDispatcher(909): channel '42365390 com.appfamily.PegPuzzle2Trial/com.appfamily.PegPuzzle2Trial.IAPActivity (server)' ~ Channel is unrecoverably broken and will be disposed!

I will have another look tomorrow and see if I can spot something. But I'm out of ideas.

appfamily commented 9 years ago

If I modify line 299 in AmazonAppstoreBillingService.java as below (setting price as an explicit string) everything works fine:

final String price = "1.99";//product.getPrice().toString();

I'm using version 2.0.1 of Amazon's IAB - could that be the issue?

RomanZhilich commented 9 years ago

I'm using version 2.0.1 of Amazon's IAB - could that be the issue?

Actually it might be, we've been using 2.0.0 You can always find current version here. Can you please provide a link to download 2.0.1? I wasn't able to find it on main site. I'll check if they changed something about price. However it seems unlikely they would change it in a minor update...

appfamily commented 9 years ago

2.0.1 jar was in the sdk package when I installed their 2.0 version from their website. Can doublecheck later today. On Nov 17, 2014 11:01 PM, "Roman Zhilich" notifications@github.com wrote:

I'm using version 2.0.1 of Amazon's IAB - could that be the issue?

Actually it might be, we've been using 2.0.0 You can always find up to date version here https://github.com/onepf/OPF-mvn-repo. Can you please provide a link to download 2.0.1? I wasn't able to find it on main site. I'll check if they changed something about price. However it seems unlikely they would change it in a minor update...

— Reply to this email directly or view it on GitHub https://github.com/onepf/OpenIAB/issues/390#issuecomment-63384328.

appfamily commented 9 years ago

You can see that it is 2.0.1 in the SDK content listing on their webpage: https://developer.amazon.com/public/resources/development-tools/sdk

akarimova commented 9 years ago

One of our users reported the same problem via e-mail, later he said that the initial exception was fixed by using a new version of sdk tester. Could you please share a link to your sdk tester?

appfamily commented 9 years ago

I have version 2.0.0.16. Not sure where I got it from, sorry

On November 21, 2014, at 12:05 PM, Anastasiia Karimova notifications@github.com wrote:

One of our users reported the same problem via e-mail, later he said that the initial exception was fixed by using a new version of sdk tester. Could you please share a link to your sdk tester?

— Reply to this email directly or view it on GitHub.

appfamily commented 9 years ago

Just checked, that is the latest version on Amazon app store

On November 21, 2014, at 1:01 PM, App Family AB per.haglund@appfamily.se wrote:

@font-face{font-family:Calibri;panose-1:2 15 5 2 2 2 4 3 2 4;}

I have version 2.0.0.16. Not sure where I got it from, sorry

On November 21, 2014, at 12:05 PM, Anastasiia Karimova notifications@github.com wrote:

One of our users reported the same problem via e-mail, later he said that the initial exception was fixed by using a new version of sdk tester. Could you please share a link to your sdk tester?

— Reply to this email directly or view it on GitHub.

RomanZhilich commented 9 years ago

Could you please share a link to your sdk tester?

I'm pretty sure last one must be available from Amazon store. I don't think they allow side downloads, so you should probably try to install it from there. If its not convenient, I'll share apk from some of our device.

appfamily commented 9 years ago

You misunderstand, I have the latest from the store already On Nov 21, 2014 3:44 PM, "Roman Zhilich" notifications@github.com wrote:

Could you please share a link to your sdk tester?

I'm pretty sure last one must be available from Amazon store. I don't think they allow side downloads, so you should probably try to install it from there. If its not convenient, I'll share apk from some of our device.

— Reply to this email directly or view it on GitHub https://github.com/onepf/OpenIAB/issues/390#issuecomment-63978777.

RomanZhilich commented 9 years ago

You're right. Sorry my bad. I'll test is shortly with iab 2.0.1 and last SDK tester from store.

RomanZhilich commented 9 years ago

I wasn't able to reproduce the issue. What device do you have, and what Android version is installed on it?

Have you tried to simply reinstall SDK tester?

appfamily commented 9 years ago

Kind Fire HDX (3rd Generation) Fire OS 4.5.1

Looking at their specs, Android compatible version should be 4.4.2 level 19.

I've not tried re-installing the tester. I'll try to do so in a few weeks (I work on apps part time only and now is a busy time ahead of Christmas - sorry!).

Thank you for your prompt support!

On 21 November 2014 19:00, Roman Zhilich notifications@github.com wrote:

I wasn't able to reproduce the issue. What device do you have, and what Android version is installed on it?

Have you tried to simply reinstall SDK tester?

— Reply to this email directly or view it on GitHub https://github.com/onepf/OpenIAB/issues/390#issuecomment-64011139.

Per Haglund | App Family | +46707920891 | www.appfamily.se

Connect with us on Facebook http://www.facebook.com/appfamily, Twitter http://twitter.com/AppFamilyABor LinkedIn http://se.linkedin.com/company/app-family-ab

akarimova commented 9 years ago

@RomanZhilich, take a look, please

RomanZhilich commented 9 years ago

Any updates? Latest release has been updated to Amazon in-app 2.0.1

appfamily commented 9 years ago

I can test in January, after Christmas holidays Den 24 dec 2014 16:03 skrev "Roman Zhilich" notifications@github.com:

Any updates? Latest release has been updated to Amazon in-app 2.0.1

— Reply to this email directly or view it on GitHub https://github.com/onepf/OpenIAB/issues/390#issuecomment-68057100.

reset commented 9 years ago

@RomanZhilich @akarimova I'm experiencing this same problem within a Unity project while using:

It seems that the OpenIAB-Unity plugin was built using version 0.9.7.2 of the OpenIAB project which is the release before Amazon IAP 2.0 was supported. Are there any plans to update/release a new version of the OpenIAB-Unity plugin which will be compatible with the latest version of OpenIAB? Thank you!

RomanZhilich commented 9 years ago

Actually there are newer versions. They're attached to OpenIAB releses: https://github.com/onepf/OpenIAB/releases

reset commented 9 years ago

@RomanZhilich thanks very much!