App is crashing but works well with companion

Hello everyone.
I have a problem with Building an app.
it works very well with ai companion but when I build it, and download it on my phone it crashes. After opening the app,1st screen respones but 2nd screen remain hang and after a few moments it shows "App is not responding"


here is the aia file
Video_Mania.aia (2.2 MB)

Use logcat to find out what is happening.

This usually happens because the Companion and the compiled APK run the app differently. The Companion executes things dynamically, while the APK has to load everything directly on the device, so some issues only appear after compiling.

I saw this post an hour ago and tried to replicate it by myself locally, these can be the common issues:

1. Large media files (memory issues)
If Screen2 loads multiple videos or large images, the APK can crash due to memory limits. The Companion shares memory with the host app, so it sometimes hides this problem.

Fix: Compress images (ideally <300KB) and avoid loading all media at once.

2. File path problems
In the Companion, assets come from a temporary directory, but in the APK they’re bundled inside the app. Hard-coded or dynamically built file paths can fail after compilation.

Fix: Always reference assets just by filename not full paths.

3. Missing permissions
If Screen2 uses things like camera, microphone, storage, or internet, make sure the related components exist in that screen so App Inventor includes the required permissions.

4. Heavy operations during Screen.Initialize
If Screen2 loads videos or large data immediately during Screen.Initialize, the app can freeze or crash.

Fix: Delay that logic slightly using a Clock.Timer and start the heavy work there.

Quick way to debug:
Add a Notifier.ShowAlert at the start of Screen2.Initialize. If it never appears, the crash is happening before Screen2 finishes loading, which usually means a component initialization issue.

If you can share what components are on Screen2, I can narrow it down further.

Thanks for replying dear. Actually there is an extension which is outdated.After removing that,my app works fine .

Glad you figured it out! then for anyone else hitting this in future "works in Companion but crashes as APK" A quick way to find the culprit: remove components/extensions one at a time and rebuild until the crash stops.

1 Like

Or test as you go,

make a change, compile and test. Repeat.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.