How to determine the location of the error?

I am getting this bug report in my app which is actively interacting with the bluetooth bracelet. It can be seen that the error is nullpointerexception, but how to understand where in the appinventor this exception is raised? How can I debug the application? Or how to get around this exception

Hello MtZay

  1. You are using the latest version MIT BLE Extension?
  2. Your App successfully connects to the bracelet?

I think we need to see your App Blocks:
To post an image of your Blocks to the forum, just right-click in the Blocks work space and select "Download Blocks as Image".

  1. Yes
  2. Yes
    The thing is, it turned out quite cumbersome. Do you only need blocks where bluetooth is directly involved? But still, I would like to learn how to deal with these errors in general, so as not to disturb the forum, if possible

Potentially two sources resulting in error:

  1. Something wrong in the Extension itself
  2. Something wrong in your Blocks code

Mostly, recognising the potential for error in the Blocks when interacting with the BLE Extension comes with experience. It's usually easier if the hardware is a microcontroller since we then have a script and can see the full communications picture.

Some would say yes - others like myself prefer to see the whole picture - often someone thinks that certain Blocks would not have any effect and does not present them, then days or weeks later we discover that they triggered something that triggered something else that brought about a failure......... This is often true if another extension is being used too, for any purpose, as there could be a clash of Java classes.

I understand, but laying it out here in separate blocks will be very difficult and cumbersome. If possible, I could give you access to the application, or make it public

upd: aia file - Altr_NewConnectCheck.aia - Google Drive

Your blocks have 108 warnings, and 8 errors.

They look like some one took a sledge hammer to them and ran them through a crusher.

Sweep away the rubble and fix the errors before expecting any help.

Extension trouble
This duplication of extension versions looks like trouble.
See the instructions for how to clean out old versions of extensions in

I see you are using two BLE components, and you are using the 20200828 BLE extension version.

There is a newer BLE version available, and a post on how to use multiple BLE connections at

With the updated extension, the problem persisted. to cut off the variant of the two versions bluetooth - I removed one device, the problem persisted.

Can you post your updated Project File?

Looking at the error again


It is possible that your App is assumed connected to a device (bracelet) when it is not. Perhaps you have the device address hard-coded rather than selected from a list of 'found' devices?

Yes, there is a problem with a supposedly connected bracelet, but in fact it is not connected. This problem was solved by periodically polling the state of the characteristic, once every few seconds, and if there is no answer, then the connection is made again and this solves the problem. Yes, hard binding to MAC

... that is what triggers the java error message though. You could try the App Inventor error reporters - if either work with this particular error, then you can 'cheat' and not display the error (you will have to report the error in your tests, in order to know what to suppress).

What are the APP Inventor error reports?
Do I need to remove the hard binding to the MAC?

No, that's fine, just ensure you are using the latest BLE extension:

1 Like