Debug in running time in different phones

181 views
Skip to first unread message

Pablo Bertu

unread,
Jun 30, 2018, 8:15:53 AM6/30/18
to MIT App Inventor Forum
Hi there,

I´ve finished my app, and even published it in Google Play as internal test.  Many of my coworkers are trying it before public release.

In some phones it works great, but in around 20% of them it won´t even open the initial screen.  It works in some devices with Android 6 or 7, and it doesn´t work in others with the same versions.

It´s a fairly complex app, including +2000 blocks, 3 screens (Menu, Main and WebViewer), a FusionTables connection, some Google Sheets links, ColinListViews and a number of extensions from different developers.

I guess I can rework it to reduce it to 2 screens and replace some extensions.... but before going into all that trouble I´d like to know if there´s a way to debug the apk in running time in different phones.

As they are not mine, I can´t ask the owners to root them.  

Is there any standard way to know why or at which point the app crashes? Any log, file, etc, that is not very intrusive for the phone´s owner?

Any help or suggestions will be welcome!

Thanks in advance. Regards,

Pablo

Taifun

unread,
Jun 30, 2018, 10:58:08 AM6/30/18
to mitappinv...@googlegroups.com
check the detailed crash reports in your Google Play Console

and make sure to follow tip1 and 2

  1. Use different screens wisely
    Before starting to create another screen, first you should think about is it really necessary? See also Building apps with many screens and SteveJG's post about advantages/disadvantagesbecause in only one screen you also can use vertical arrangements to simulate different screens, just set the arrangements to visible = true/false as needed... See also Martyn_HK's example about how to use Tabs in App Inventor and another example from Cyd

    If you decided to use different screens, then you should switch them correctly, else you will run out of memory after a while...      
    The recommended method of switching screens in App Inventor

  2. App Inventor works best if you use images whose size matches the size you want them to appear on your screen. If you import larger images into your app, your app may run out of system memory. Using Images with App Inventor

    by Italo: First, you need to understand that the file size of an image is not the amount of memory it uses when it's being displayed. The file size is the compressed size, much like a zip or rar file. When viewed, the image needs to be decompressed.
    For example, if your image says its file size is 100 kb, and its dimensions are 1024 x 768, 32 bit color, then that image uses over 3 mb of RAM (not 100 kb!) when you show it on the screen. ((1024 * 768 ) * 32) / 8 = 3,145,728 kb (3 mb)
    Now, this is a mistake most people make when using arrangements as "virtual screens": They set different image components with their images loaded but hidden, instead of having only one image component and changing the picture according to the user's selection or app events, not knowing that apparently the hidden image components are also using the ram, (yes, even though they are invisible!).

  3. Avoid redundancy
    Probably it helps to read chapter 19 - 21 in Dave's book http://www.appinventor.org/book2 to get an idea how to do DRY programming with App Inventor - Don't repeat yourself 

  4. See SteveJG's monster list of tips and tricks

  5. How to overcome the App Inventor project limit of 10 MB

  6. Backup your project frequently
Taifun

Trying to push the limits of App Inventor! SnippetsTutorials and Extensions from Pura Vida Apps by  Taifun. 


Pablo Bertu

unread,
Jun 30, 2018, 12:34:39 PM6/30/18
to MIT App Inventor Forum
Yes, good point Taifun. I've checked it and no data. Maybe it's updated every couple of days. Thanks!

Pablo Bertu

unread,
Jun 30, 2018, 3:29:35 PM6/30/18
to MIT App Inventor Forum
I´ve been able to download some logcat.txt files from Google Play Console.  Mostly cryptical :)

Anything to look for in those files?

Taifun

unread,
Jun 30, 2018, 6:09:13 PM6/30/18
to MIT App Inventor Forum
you might want to look for errors, for example out of memory errors....
you might want to upload one of these reports into this thread?
Taifun

Pablo Bertu

unread,
Jun 30, 2018, 7:18:17 PM6/30/18
to MIT App Inventor Forum
Here they are! They are reported as ANR events. I imagine the app is virtually run in phone emulators, right?



logcat-GalaxyS7-Android6.txt
logcat-LG_G6-Android7.txt

Taifun

unread,
Jul 1, 2018, 9:52:29 AM7/1/18
to MIT App Inventor Forum
this is what I found in the 2nd logcat result
06-23 14:48:56.541: E/ActivityManager(1612): ANR in appinventor.ai_pbertu.BigDipperV0_9 (appinventor.ai_pbertu.BigDipperV0_9/.Screen1)
06-23 14:48:56.541: E/ActivityManager(1612): PID: 10349
06-23 14:48:56.541: E/ActivityManager(1612): Reason: Input dispatching timed out (Waiting because no window has focus but there is a focused application that may eventually add a window when it finishes starting up.)

you might find an answer to the problem here

Taifun

Pablo Bertu

unread,
Jul 1, 2018, 10:33:34 AM7/1/18
to MIT App Inventor Forum
Taifun, you rock!!

It looks very difficult to pinpoint the exact reason for the ANR. Some function or event is generating a timeout, or that is what I could understand.



I guess I will have to simplify the app and remove most of the fancy functions (splash screen, 2nd screen menu, etc) to check if it works well in the devices where the ANR shows. I´m already at it.

Thanks A LOT (not yelling, just being emphatic!) for your time and help.

Saludos!

Pablo

Reply all
Reply to author
Forward
0 new messages