Unity smart contract example hangs in Android

The smart contract code in David Pradell’s tutorial “Unity Web3 for Beginners - Smart Contract Interaction, Solidity, Hardhat, Moralis, C#, WebGL” is not working in Android. It successfully runs in the Unity Editor on my PC and also when I build for WebGL :slightly_smiling_face: . When I build and run on my Android phone, the dapp works almost to completion - it writes a proper record in the MoriaGatesEvent table but then pauses with the message “Waiting for Contract Event…”. Interestingly, it eventually continues, but only when the record is ‘confirmed’ in the database, which has taken typically about 10-12 minutes, but it continues, unfortunately, by closing itself in Android - yes, the app shuts down :slightly_frowning_face: . Has anyone else observed this behavior?

Is there an error log of the crash, so maybe someone can relate to the errors.

Hi John - yes, I have a logcat file and would be glad to share it with anyone…

1 Like

Yes share the log here please - if it is too long to post, cut out any non errors or info related to the crash. Does it happen on an emulated Android device?

Hi glad - I cleared the logcat, then filtered the adb logcat command to only show Moralis logs, then fired up the app, waited until it crashed, the copied the logs - there’s about 2500 logged lines of Moralis info. Is there another way to sent the text file? I’ve created a shared Google drive and put it there - can you dm me so I can share it with you?

Btw, I don’t have an emulated Android device installed…

You can use something like https://www.codepile.net/

Btw, I don’t have an emulated Android device installed…

I see, was wanting to see if the same issue happens on another device/phone.

Right. I’ve been meaning to dig out one of my older Android phones an use it for testing as well. I currently use a Samsung Galaxy S20 FE 5G running Android 11. Thanks for the codepile tip, I put the logcat output here: https://www.codepile.net/pile/vPDXWzPy

Hi glad - I dragged out my OnePlus 7T Android phone and installed MoriaGates and it behaves exactly as it does on my Samsung Galaxy S20, both running Android 11, as described earlier. :frowning:

I see, there are a few crash errors in the log but I’m not sure what they mean exactly.

Does your code more or less match the tutorial repo?

Yes. I downloaded the repo and built without any changes. It works perfectly when run in the PC Unity Editor environment and when built and run in WebGL…