Debugging Android Tips for beginners

Working on an app that needs to run on both iOS and Android, I ran into some issues that if (like me) you are new to Android development, could be frustrating and making you doubt yourself. My app worked fine on a Samsung A16, S25 but not on a S22. (And yes, you will need several test devices if you want to develop for Android as they are certainly not all equal and the simulator will not be enough)

What happened on the S22 was the following; the app would open with a black screen for a few seconds, then show the actual main screen, and after 12 seconds crashes.

The cause was changing the position of a canvas at runtime. The A16 and S25 were fine with that, but the S22 crashes as described. So if your app runs fine on one device but starts with a black screen on another device and crashes after 12 seconds, remove all code that changes controls position or dimensions on your main screen on launch. If the app then starts with your main screen immediately, you know you’re doing something some Android devices don’t like.

1 Like

is this an android “feature” or do you think it’s a bug in the xojo android framework ?
if so you should make a small test project and file a bug report ?

1 Like

As far as I know, this is a “feature” of some Android phones with a more strict rendering pipeline (like the S22) I will make a test project to see if I can replicate it without all of my controls on it. It’s easy to workaround but if you don’t know that Android kills an app after 12 seconds if it thinks it fails, it’s hard to find the reason of the crash. And I noticed the screen turning black before showing the main screen, but did not understand that’s a sign of a bug.