• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!
  • Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Android iap_consume crashes game

T

turra

Guest
Hi,

Everything here works 100% on iOS, and on android the rest of the IAP stuff seems to work fine, I pull down the products and their prices etc. However as soon as I call iap_consume, the game crashes. It doesn't get to running the async in app purchases event, just seems to die immediately. Here is the error I get:

Abort message: 'art/runtime/java_vm_ext.cc:470] JNI DETECTED ERROR IN APPLICATION: the return type of CallStaticLongMethodV does not match void com.yoyogames.runner.RunnerJNILib.ConsumeInAppPurchase(java.lang.String, java.lang.String)'

and the full thing incase that helps:

Code:
01-14 19:10:58.413 28988 28988 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
01-14 19:10:58.413 28988 28988 F DEBUG   : Build fingerprint: 'google/sdk_google_phone_x86/generic_x86:7.0/NYC/4409132:user/release-keys'
01-14 19:10:58.413 28988 28988 F DEBUG   : Revision: '0'
01-14 19:10:58.413 28988 28988 F DEBUG   : ABI: 'x86'
01-14 19:10:58.413 28988 28988 F DEBUG   : pid: 28833, tid: 28852, name: GLThread 1410  >>> com.polydog.wagroyale <<<
01-14 19:10:58.413 28988 28988 F DEBUG   : signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
01-14 19:10:58.413 28988 28988 F DEBUG   : Abort message: 'art/runtime/java_vm_ext.cc:470] JNI DETECTED ERROR IN APPLICATION: the return type of CallStaticLongMethodV does not match void com.yoyogames.runner.RunnerJNILib.ConsumeInAppPurchase(java.lang.String, java.lang.String)'
01-14 19:10:58.413 28988 28988 F DEBUG   :     eax 00000000  ebx 000070a1  ecx 000070b4  edx 00000006
01-14 19:10:58.413 28988 28988 F DEBUG   :     esi 8c3ff978  edi 8c3ff920
01-14 19:10:58.413 28988 28988 F DEBUG   :     xcs 00000073  xds 0000007b  xes 0000007b  xfs 0000003b  xss 0000007b
01-14 19:10:58.413 28988 28988 F DEBUG   :     eip aa73c424  ebp 8c3fe478  esp 8c3fe41c  flags 00000292
01-14 19:10:58.415 28988 28988 F DEBUG   :
01-14 19:10:58.415 28988 28988 F DEBUG   : backtrace:
01-14 19:10:58.415 28988 28988 F DEBUG   :     #00 pc ffffe424  [vdso:aa73c000] (__kernel_vsyscall+16)
01-14 19:10:58.415 28988 28988 F DEBUG   :     #01 pc 0007a00c  /system/lib/libc.so (tgkill+28)
01-14 19:10:58.415 28988 28988 F DEBUG   :     #02 pc 00075855  /system/lib/libc.so (pthread_kill+85)
01-14 19:10:58.415 28988 28988 F DEBUG   :     #03 pc 0002782a  /system/lib/libc.so (raise+42)
01-14 19:10:58.415 28988 28988 F DEBUG   :     #04 pc 0001ee06  /system/lib/libc.so (abort+86)
01-14 19:10:58.415 28988 28988 F DEBUG   :     #05 pc 00513387  /system/lib/libart.so (_ZN3art7Runtime5AbortEv+423)
01-14 19:10:58.415 28988 28988 F DEBUG   :     #06 pc 00119572  /system/lib/libart.so (_ZN3art10LogMessageD1Ev+1298)
01-14 19:10:58.415 28988 28988 F DEBUG   :     #07 pc 0038efc5  /system/lib/libart.so (_ZN3art9JavaVMExt8JniAbortEPKcS2_+3445)
01-14 19:10:58.415 28988 28988 F DEBUG   :     #08 pc 0038f168  /system/lib/libart.so (_ZN3art9JavaVMExt9JniAbortVEPKcS2_Pc+120)
01-14 19:10:58.415 28988 28988 F DEBUG   :     #09 pc 0013d112  /system/lib/libart.so (_ZN3art11ScopedCheck6AbortFEPKcz+82)
01-14 19:10:58.415 28988 28988 F DEBUG   :     #10 pc 00140c22  /system/lib/libart.so (_ZN3art11ScopedCheck17CheckMethodAndSigERNS_18ScopedObjectAccessEP8_jobjectP7_jclassP10_jmethodIDNS_9Primitive4TypeENS_10InvokeTypeE+450)
01-14 19:10:58.415 28988 28988 F DEBUG   :     #11 pc 0013faff  /system/lib/libart.so (_ZN3art8CheckJNI11CallMethodVEPKcP7_JNIEnvP8_jobjectP7_jclassP10_jmethodIDPcNS_9Primitive4TypeENS_10InvokeTypeE+1295)
01-14 19:10:58.415 28988 28988 F DEBUG   :     #12 pc 001319bc  /system/lib/libart.so (_ZN3art8CheckJNI21CallStaticLongMethodVEP7_JNIEnvP7_jclassP10_jmethodIDPc+108)
01-14 19:10:58.415 28988 28988 F DEBUG   :     #13 pc 001a10fe  /data/app/com.polydog.wagroyale-1/lib/x86/libyoyo.so (_ZN7_JNIEnv20CallStaticLongMethodEP7_jclassP10_jmethodIDz+62)
01-14 19:10:58.415 28988 28988 F DEBUG   :     #14 pc 001a1082  /data/app/com.polydog.wagroyale-1/lib/x86/libyoyo.so (_Z12IAP_ConsumeMPKc+338)
01-14 19:10:58.415 28988 28988 F DEBUG   :     #15 pc 00192535  /data/app/com.polydog.wagroyale-1/lib/x86/libyoyo.so
01-14 19:10:58.415 28988 28988 F DEBUG   :     #16 pc 00191463  /data/app/com.polydog.wagroyale-1/lib/x86/libyoyo.so (_Z13F_IAP_ConsumeR6RValueP9CInstanceS2_iPS_+435)
01-14 19:10:58.415 28988 28988 F DEBUG   :     #17 pc 00105730  /data/app/com.polydog.wagroyale-1/lib/x86/libyoyo.so (_Z13DoCallLibraryjPhPKhP6VMExec+304)
01-14 19:10:58.415 28988 28988 F DEBUG   :     #18 pc 001087f1  /data/app/com.polydog.wagroyale-1/lib/x86/libyoyo.so (_ZN2VM11ExecReleaseER6VMExecP6RValue+225)
01-14 19:10:58.415 28988 28988 F DEBUG   :     #19 pc 0010862e  /data/app/com.polydog.wagroyale-1/lib/x86/libyoyo.so (_ZN2VM4ExecEP5CCodeP12YYObjectBaseS3_P6RValueS3_iS5_iS3_+1454)
01-14 19:10:58.415 28988 28988 F DEBUG   :     #20 pc 000f2fd7  /data/app/com.polydog.wagroyale-1/lib/x86/libyoyo.so (_Z9ExecuteItP9CInstanceS0_P5CCodeP6RValuei+231)
01-14 19:10:58.415 28988 28988 F DEBUG   :     #21 pc 000f30ec  /data/app/com.polydog.wagroyale-1/lib/x86/libyoyo.so (_Z12Code_ExecuteP9CInstanceS0_P5CCodeP6RValuei+44)
01-14 19:10:58.415 28988 28988 F DEBUG   :     #22 pc 0011718d  /data/app/com.polydog.wagroyale-1/lib/x86/libyoyo.so (_ZN6CEvent7ExecuteEP9CInstanceS1_+77)
01-14 19:10:58.415 28988 28988 F DEBUG   :     #23 pc 00117438  /data/app/com.polydog.wagroyale-1/lib/x86/libyoyo.so (_Z26Perform_Event_Object_ASyncP9CInstanceS0_iii+232)
01-14 19:10:58.415 28988 28988 F DEBUG   :     #24 pc 0011755b  /data/app/com.polydog.wagroyale-1/lib/x86/libyoyo.so (_Z13Perform_EventP9CInstanceS0_ii+123)
01-14 19:10:58.415 28988 28988 F DEBUG   :     #25 pc 0023c2b6  /data/app/com.polydog.wagroyale-1/lib/x86/libyoyo.so (_Z12HandleButtoni+326)
01-14 19:10:58.415 28988 28988 F DEBUG   :     #26 pc 0023cb4c  /data/app/com.polydog.wagroyale-1/lib/x86/libyoyo.so (_Z11HandleMousev+844)
01-14 19:10:58.415 28988 28988 F DEBUG   :     #27 pc 0023aff4  /data/app/com.polydog.wagroyale-1/lib/x86/libyoyo.so (_Z7DoAStepv+564)
01-14 19:10:58.415 28988 28988 F DEBUG   :     #28 pc 0023b709  /data/app/com.polydog.wagroyale-1/lib/x86/libyoyo.so (_Z16MainLoop_Processv+1241)
01-14 19:10:58.415 28988 28988 F DEBUG   :     #29 pc 00320dad  /data/app/com.polydog.wagroyale-1/lib/x86/libyoyo.so (Java_com_yoyogames_runner_RunnerJNILib_Process+845)
01-14 19:10:58.415 28988 28988 F DEBUG   :     #30 pc 0061599d  /data/app/com.polydog.wagroyale-1/oat/x86/base.odex (offset 0x59d000)

Edit: Further testing, I made a new basic project and imported the google play services and iap extensions, tried to use the same IAP and got the same error. Then I changed the package to an old app I published and made a new IAP for that app, tried to consume that new thing (I changed the license key!) and it gave the same error as above
 
Last edited by a moderator:
T

turra

Guest
I've tried reverting back to old GMS2 versions and runtimes, I've done a fresh install of android studio and all of those parts following the required sdk numbers from the help section of the site. Made sure my GPS extensions are up to date, but still get the same error.
 
Last edited by a moderator:
T

turra

Guest
If anyone finds in the future, hello! Chances are good you're using an emulator rather then a real android phone to test this on?
Well the good news is this problem doesn't happen on real devices (it seems). So if you can test on one, great!
However if you need to keep using an emulator you'll need to set it up in a certain way.

When you create a new virtual device in android studio and it asks you to select a system image, click on either x86 Images or Other images. The key thing is that you need (Google APIs) after the Android version number here. Get the device going, name it something easy to remember and type (I just used 'AVD_1').
Looking at the virtual device you might notice that it has no Google Play Store! So we have to manually install that ourselves. Go here: https://opengapps.org/#downloadsection
and download the "pico" variant, make sure your architecture matches your emulator and so on. Open the archive it downloads and either extract it all somewhere, or you can just extract the file Core/vending-x86_64.tar.lz (here it might have a slightly different name if your emulator platform was different!)

Now we need to open up this tar.lz file, if you have lzip installed already skip ahead a bit, if not then you might need a windows package manager to get it, I used Chocolatey: https://chocolatey.org/
Install that, then in a command line do
Code:
choco install lzip
We can unzip vending-x86_64.tar.lz now with
Code:
tar -xf vending-x86_64.tar.lz
Now go into the folders you've just unarchived and find the file Phonesky.apk (Core\vending-x86_64\nodpi\priv-app\Phonesky\Phonesky.apk)
Keep this somewhere you remember or if you want it to be easiest, move it to your android platform-tools folder. If you're not sure where that is check in Gamemakers android platform settings what folder you have as your Android SDK, it's in there.

Go to your android sdk folder then open the tools folder. shift+right click and open a powershell window and use this command to start up the emulator:
Code:
./emulator '@AVD_1' -writable-system
replacing AVD_1 with whatever you named your emulator

Now go to your android sdk folder again, but go into the platform-tools folder, open another powershell window here and use the command
Code:
./adb shell
su
Now we need to know the location of the system directory of the emulator, so use the command
Code:
cat /proc/mounts|grep system
This might give you a very long string, it should start with /dev/block then after it ends there should be a space and /system then some more stuff.
you're gonna need to copy the first parts in the next command so replace /dev/block /system with whatever your emulator spits out
Code:
mount -o rw,remount /dev/block /system
After this we restart adb as root with
Code:
./adb root
and then push the apk onto the emulator (this is if you moved it to this directory, if not use the correct path to where you put it)
Code:
./adb push Phonesky.apk /system/priv-app/
then restart the virtual device with
Code:
./adb shell stop
./adb shell start
Now there should be a Google Play Store in your app list! Ok so now that's there we still need to disable the JNI check that causes the crash.
This is much more straight forward, just use the commands
Code:
./adb shell stop
./adb shell setprop dalvik.vm.checkjni false
./adb shell start
The emulator should restart again, and now whatever was crashing from this error, hopefully, does not anymore!
 

Genetix

Member
Thanks for properly documenting this, may be back in the near future as I work on new IAP projects myself!
 
Top