Calling a procedure crashes the App

So far the app crashes when calling PatternScreen procedure, I have narrowed it down to when the three blocks ColourSliders, Connecting_Screen and Settings Screen are in the procedure. Without these blocks the screen becomes cluttered with the settings menu and the connecting menu, not very user freindly.
(Note I am using Layouts as screens to maintain a BT connection)

  • A thought was it depended on the vertical/ horizontal/ tile layout, not the case...
  • Another thought was that a name was changed and the block never updated, not the case...
  • I disables the two clock blocks and that didn't help...
  • The three blocks are set default visible in the designer tab, as I've had the app crash on me before due to three or four being set not visible...


Hoping its the kind of problem I wake up to tomorrow and it fixes itself.

Try disabling all clock timers in the Designer, to avoid timing mishaps.

If that fails,

(Canned Reply: ABG- Export & Upload .aia)
Export your .aia file and upload it here.

Thanks for the speedie reply.
Completely took out the feature that used the clock, and the clock, still not working...
Only difference in the uploaded .aia file is that the Screen Initiation goes to a connecting screen, (tap the BT logo, wait, then connection is gonna fail), goes to a screen to let you choose your device, press LED Patterns button on the bottom button bar it crashes.

For testing, change the Screen1.Initilatize to Pattern Screen, it means the app will crash straight away without constantly trying to attempt connecting to BT that's not there.
I found the three issue blocks by removing all blocks from the procedure except the pattern screen, connected to the MIT companion app, added blocks back one by one refreshing companion app screen, till it crashed.

To help see the screens in the display tab turn them invisible. Caution is if one or all are still set invisible when connecting to the Companion App it will crash regardless.

BT_Lights_5_Revived.aia (974.6 KB)

Dear @EEE_nerd,
I've changed in the Screen1 Initialize the call to the Pattern Screen and compiled your .aia into an .apk. Downloaded on my Lenovo pad, it works (or at least it doesn't crash even there isn't any BT device connected).
So the difference is that you use it with the Companion ? Else, what is your "Companion App" ?

1 Like

The last post was not a solution (thats why its deleted), thanks @uskiara for taking the time to look. I'm still working off the fact, that its the three blocks causing it to crash. Tried building the app and running but still run into the issue, even when the initialise screen is set to the PatternScreen.

More specifically I find the crash occurs when running normally and you change from any screen to the PatternScreen, I'm investigating the possible cause being that a layout box within the PatternScreen layout which is made visible/invisible by a switch in a different "screen" (I'm using " " because it isn't a Screen according to MIT App its just a layout box that is made visible or invisible). I've also tried putting the main screen first and last in the procedure.
Still confusing me as they are defined as visible from the designer tab as default, (usually having them invisible makes the app crash...)

Write what steps need to be taken in your app to trigger the error, because when testing your project everything works fine for me.

I'm not sure if I separated the three troublesome blocks or not, in the app I sent you. I'll send you another but I think I'm hitting a wall here..
BT_Lights_5_Revived.aia (976.3 KB)
I set the initialise screen to the patternScreen in this version, I left out the three trouble blocks and yes the app opens into the pattern screen except the other screens clutter the screen aswell... if you click the BT or the gear icon, then the pattern button it crashes :frowning:

I had a thought that was, if you set a layout to visible after it was already set as visible it would crash but that is disproved as my app can go between the settings and the BT connect "screen" with no issue @Patryk_F

Well I walked away from it, came back, deleted the troublesome blocks recreated them and it worked, nothing changed about the block, entirely the fact it was a fresh block, I'm speechless...


Maybe copy and pasting it had an impact, or the app was holding data, or the order of the blocks in the procedure, or the blocks expired, got stale and moulded? @MIT any clues
Because I typed this post went back to check on it and now it doesn't work

Dear @EEE_nerd,
sorry not having been capable to help you. I've been out for a few days and I read only now your answer.
When you say "copy and paste" do you mean by means of the backpack ? It has happend to me that sometimes the backpack didn't work as expected. Have you tried to make a freshly new app from scratch (and not only to rewrite the "despicable" :frowning_face: blocks) ?

@uskiara @ABG @Patryk_F

So, took a break from the project and returned with the dis-hearting knowledge that I would have to revive the project by starting fresh. Started a new project and copied and pasted the designer component tree to the new project, pictured below, thank you @MIT for this feature!!! Made some simplifications aswell.

Started with a empty block screen, made a simple block programme, pictured below, that only switched between screens. unimportantSideNOTE, previously I ran into problems when emulating using the companion app, it crashed if the screens where set invisible by defaut via the display tab. Doesn't do it on this version so bonus :smiley:

The error strikes when making 'Pattern_buttons' layout visible. This error is not due to the long click of the LED_Pattern button. I put the long click there to test/show that it is purely the action of making the Pattern_buttons layout visible which does indeed crash the app.

BT_Lights_CPR.aia (35.2 KB)
I've called it CPR as it feels like I'm resuscitating this back to life. :upside_down_face:

I'm at the end of my wit with this, so may have to re-jig the app to work around the bug.. any help is nice, and thanks for all the support.

Hi @EEE_nerd,
I've tested your new .aia and it "works".
In other words: by pressing the LED_Pattern button nothing "strange" happens. Therefore I've set as invisible the Pattern_LED screen, I recompiled, and it works well: when I hit the button, the screen appears..
I've then changed your code as follows:
and it still works fine. My testing device is a Lenovo pad M8, Android 9.
(Have you tried to use another phone ?)

A normal click of the LED_Pattern button should produce.

The long click should display below.

It still crashes, even after adding the if condition. I am on Samsung Galaxy S10+, Android 12

as I said, my Lenovo pad is featuring Android 9 and it works as per your screenshots.
The condition I added was just to try a different behaviour of the app, so to see if, in a different situation, the app could crash.
A question arises: what do you mean for "the app crashes": a runtime error appears ? the app shuts down itself ? An Android message in shown ?

Or: have you tried with another phone ?


1 Like

Yep, runtime error, in the previous post I've edited to show the phone type, most of my family is Apple :confused:
Edit not a runtime error!!

I've taken away the Pattern_buttons layout and its still crashing, a friend may have an android so will go from there. I have an itch its due to all the layout boxes taking up more screen space than available but surely it would allow you to scroll, does it scroll for you?
BT_Lights_CPR (1).aia (35.1 KB)

Show the runtime error here....

To find out more, use logcat


1 Like

Sorry not a runtime error, the app straight up closes..

Downloaded most of the files, is this an extension of android studio?

To test the hypothesis that the order of hiding and exposing Arrangements might cause timing problems in sizing screen components, try this variant that hides all VAs before exposing the requested VA ...

BT_Lights_CPR1.aia (34.8 KB)

For good measure, I also removed

If this does not help, I would try replacing that table arrangement with nested arrangements of fixed percentage sizes.

1 Like