I have written a hybrid game using Cordova for iOS and Android. The game ran perfectly on both iOS and Android and I was almost ready to publish it but I only needed to make a few splash screens. When that was done, I did one final test on both platforms only to find out the game crashes on Android after a few minutes of play! It has never done that before and I have no idea what is causing it. What's also new is that my phone gets so hot when playing the game, you can hardly hold it anymore after a while (I measured 126F).
I'm only using two plugins: cordova-plugin-admob-free and cordova-plugin-splashscreen. For testing purposes, I removed both to see if they were causing the crashes, but the crashes were still there.
The game crashes when built with Cordova (cordova run android --devices) and also if I build it on PhoneGab Build and install the apk manually.
I've tried debugging with chrome://inspect but I don't see any errors appearing on the console. I've also run
adb logcat
but the log is too complicated for me to understand what is causing the crash. If anyone wants to take a look at it, I've uploaded a copy of the log here. The name of the game is "mygame" (that's not really its name, but I changed it to that in the log file).
I have no idea how to find out what is causing this crash. On iOS, everything works perfectly fine. It's only Android that is causing this problem. If you need more information or if I need to be more specific, please let me know what more information you need and I will add it to this post.
EDIT August 24th 2018: I've been able to test it on another Android phone and on the simulator and it didn't crash there. I still need to figure out what is causing the crash since it's the only app that crashes on my phone. I would also like to know what is causing the tremendous battery drain when I run it. This too is new.
EDIT August 26th 2018: Well, more Android devices are experiencing the crash. I've done a few tests on my device. I removed the two Cordova plugins (AdMob en SplashScreen) en started the game. I let it sit at the opening screen so at that point, no game objects have been created yet and all it does are a few simple calculations and a few context.drawImage() calls. And still the phone gets hot and crashes after a while. Could it be that the context.drawImage() has a memory leak?
EDIT August 27th 2018: I stripped the app so that in the game's main loop only two drawImage() (and a requestAnimatonFrame()) were left. One drawImage() had a canvas as source, the other an img object. It still crashed after a while. Then I removed the drawImage() with an img object as source and it still hadn't crashed after an hour of testing. I then added a few more drawImage() all with a canvas as source - and no crash. I then replaced the canvas with an img object as source and it crashed after a few minutes. So I think it's safe to assume that a drawImage() with an img object as source is causing the crashes?
EDIT August 29th 2018: I changed all drawImages() in my code to use a canvas as source. The canvas is only filled once with an image. The first time I ran the game aferwards, it didn't crash! I thought I had solved the problem but after some more testing I found out it does crash but it takes a lot longer for the game to crash. So even though this is a good step towards a solution, it still isn't the solution.
EDIT August 30th 2018: I was able to run the game through Android Studio and when it crashed, the debug console showed this:
E/chromium: [ERROR:gl_fence_egl.cc(55)] Failed to get EGLSync attribute. error code:12300
W/google-breakpad: ### ### ### ### ### ### ### ### ### ### ### ### ###
Chrome build fingerprint:
68.0.3440.91
344009152
### ### ### ### ### ### ### ### ### ### ### ### ###
A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 13865 (Chrome_InProcGp)
Can anyone please help me debug this?
from How to find what crashes a Cordova App in Android?
No comments:
Post a Comment