Why is my app crashing - Stopwatch?

'Timer Always Fires' is for those Apps that need a timer to continue even when they are off-screen, which probably does not apply to your App. Why did you choose a 30 millisecond time interval?

Best to follow SteveJG's advice and do a search for Stop Watch (might be examples in the Gallery too) to see how to code one accurately.

I think the crash occurs because the Clock Timer Block (+ procedure) has not finished processing before it is called again.

Edit: Actually, since your timer can get into hours, 'Timer Always Fires' is appropriate.

What exactly is happening? What does crash mean? Do you get an error message?
Post the aia.

Set your timer interval to 1000
1000ms = 1 second
App should then run....

1 Like

Try this one (TimerInterval=30):
stopwatch_Anke.aia (6.9 KB)

Where do I find this block?

Also, the error that pops up on my phone says, "MIT AI2 Companion has stopped"

In my app (aia). And search for "TFormat" extension.

Works fine on my test devices.
What device and which Android version?

Android Linux 8.0.0

Build the APK and try ...


Which version?

Version 2.63

Also building the APK gives this error:

App Inventor is unable to compile this project.
The compiler error output was
________Preparing application icon
________Creating animation xml
________Creating style xml
________Creating provider_path xml
________Creating network_security_config xml
________Generating adaptive icon file
________Generating round adaptive icon file
________Generating adaptive icon background file
________Generating manifest file
________Attaching native libraries
________Attaching Android Archive (AAR) libraries
________Attaching component assets
________Invoking AAPT
AAPT time: 2.163 seconds
________Compiling source files
(compiling appinventor/ai_herui_ray_li/stopwatch/Screen1.yail to appinventor.ai_herui_ray_li.stopwatch.Screen1)

ERROR: appinventor/ai_herui_ray_li/stopwatch/Screen1.yail line 87: call to 'set-and-coerce-property!' has too few arguments (3; must be 4)

Kawa compile time: 3.286 seconds

I've downloaded the extension, how do I get the blocks in my app?

No problem to build the APK, try this:

I also tried my app (Companion & APK) on a very old Android 5 device. Works fine!

Where do I go to run the APK file that you uploaded?

Download it to your computer, copy it to your test device and install.

Ray, you don't have to use an extension:

StopWatchHMS.aia (4.3 KB)

Seems like your test works for me too...

So where is your problem?
It should also work with Companion.

Thanks! This works.

I've resolved the issue, but thanks for your help, I appreciate it!