Apk crashes but ai companion works without issue

Hello all,

I am going through this issue where the app would work on ai companion but once downloaded as apk file and installed it would crash right away.. please suggest what to do or how to share the file?

Hi. Welcome to the community. Please show us your blocks.

Hello Apologies, Please ignore my lack of awareness.

Please find the following.

image

Home


image

Settings

Room1
blocks (2)
Also please find the aia file
HomeAuto.aia (53.2 KB)

Thanks in advance.

Hello Shariq

Screen1 Designer and Blocks are completely blank. That cannot be. Screen1 will always be first in the compiled App, it's the 'King' Screen.

So i did
image
to redirect on home.. seems like it is redirecting too , after that it is crashing
The sequence is from scratch install.
It would ask me permission to allow storage>i would fill the connection port and url details. save it>click on yes>click on the home button > the screen would appear to be showing the buttons except the webview would load and then crash

A bit of a mess :upside_down_face:

I will try to reproduce the fault. What version of Android are you running?

Hmm - I don't have an AWS account

you can use connekted.pagekite.com for now... and android version in phone is 12 running realme ui 3.0

Right - Screen Initialize on the 'Home' Screen - I think it's overloaded, given that the Screen is building at that stage. I would change config_set to a global var and move the If-then-else to a Procedure, called as the last line of Screen Initialize.

There are a lot of other things wrong:

  1. You request External Storage Write Permission but do not check the response; However, I can't see any external storage being used?

  2. The code takes the User to another Screen without first disabling all Clock Timers - that will cause a crash.

  3. Several uses of 'open another screen - Screen1' which will potentially cause an issue as you will have more than one Screen1.

1 Like

See these tips too:

ProfessorCad: Tips & Tricks GUI Layout and Component Naming

ProfessorCad: Tips & Tricks Cannot Build/Install/Run APK

Hello ,while i look for those. could you suggest

  1. how to check for the response of write permission?
  2. what would be the proceedure doing at the last line of screen initialiase?
  3. how to disable the clock timers?

Why are you asking for write permission when not writing a file? Is a file written via another Screen? If so, the permission should really be requested on App launch, from Screen1.

You call the procedure from the last line - in fact, if you do need write externally:

You already know how:
Snap1

Edit: So you can do this, use one Procedure to disable the Timers and open the required screen:

Snap2

Is this actually your code?

yes i did all in many months .. i have a background in programming so the logic part was clear to me. just im revisiting after a break of few months so not very clear of blocks.. i think you too would be in the same boat :slight_smile:

The only thing that can cause your app to crash is extensions. So I suggest removing extensions one by one and checking if the apk works.

Hence my tips about naming, so that everything is easier to follow (also with copious amounts of inline notes).

Alright, it has been observed the apk is crashing after the first line, when the write external storage is called. anyway how we can over ride it?

You mean how can it be fixed?

First need to know:

  1. Is the App only for your use (not going to be distributed to others)
  2. If so what is the exact Android Version of your device (phone).

The issue will be the Google security measures that have been introduced over the past two years.

If the App is distributed, then all applicable security measures across all late Android versions must be taken into account.

If it's only for your use then only the applicable security measures that affect your version of Android need to be considered.

There are things you could do to make your App more robust. Firstly, Screen1 should be 'Home', it is the 'King' of the screens so far as Android is concerned.

Secondly, you might consider using virtual screens - sharing the same memory allocation and therefore no need to pass data between screens, no duplication of code or temporary data storage and no danger of causing the App to crash by switching screens incorrectly or leaving a clock timer on.

hello first of all, this is for me only and and my parents
secondly as i mentioned earlier, its on realme ui 3.0 running on android 12

finally, i was not able to make the screen 1 set as home and i had created home screen by mistake. How to transfer the contents of the home screen to make it more like how you have suggested? or can we create a new one and import screen blocks and components?

Sorry, i didnt understand the virtual screen concept. any example or reference would be really helpful
Thanks again.

1 Like