Ai2 application has stopped

because it wasnt reading my BLE , i wanna connect it with arduinoBLE

Okay i got it, please see this :

Error from Companion: java.lang.NoClassDefFoundError: edu.mit.appinventor.ble.BluetoothLEint$1

Same error when i open it . i followed all the steps

As far as I know, you cannot use extensions on iOS yet, if ever, therefore no BLE. Therefore you should try this on an Android phone.
And definitely install the AI Companion on that Android phone. It will help you enormously in debugging.
I looked into your .aia - what I see is that you never connect to your BLE device, so, what you have can never work. Start with the basics, do some tutorials: http://appinventor.mit.edu/explore/ai2/tutorials
or here: http://iot.appinventor.mit.edu/#/getstarted/intro

I am not familiar with thingspeak, so maybe you can explain how you plan to interface with it and why do you need both a webviewer and a BLE connection.

p.s I find your username offensive, I think you should change it. If you don't I may block you.

p.p.s. @Salman_Dev I know that you are trying to be helpful, but it would help if you would research your answers a bit better.

1 Like

Usually this error occurs if your phone is too old. The BLE extension uses APIs that aren't available until Android 5.0. On earlier versions, the class will not link correctly due to the missing dependencies, resulting in a NoClassDefFoundError.

1 Like

I will learn more, thanks for the knowledge @Ghica

An 'old' Android phone may not be compatible with BLE or the BLE Extension (Minimum Android v5.0 Lollipop required), but that is not necessarily causing your issue. Does your Project include images? In particular, a custom image for the App Icon? The problem may stem from there.

See my website for a list of possible causes:
ProfessorCad: Tips & Tricks Cannot Build/Install/Run APK
ProfessorCad: Tips & Tricks
ProfessorCad: Tips & Tricks

1 Like

Assuming your Android phone is new enough to run BLE, your Project 'ecg_rose' has an old BLE Extension. It should be version 20200828.

  1. How did you obtain the UUIDs? They need to be 100% correct.
  2. You may also need to give the phone time to list all available BLE Devices, currently the App expects the list to be built immediately on tapping Button4.
  3. Google Locate must be switched on (as must Bluetooth).
  4. You are receiving Integers into a text Block? I think we need to see your Arduino Sketch - you can upload it to your Forum Topic as a .txt file.

Hey solved the issue by changing Android Device to a new one .
Also changed my name since it was offensive for you .
Thanks alot for the help.
I implemented the basic example found in this site to connect to BLE devices .
When i click Scan , listviewer never opens.

About Thingspeak and BLe and all that , i am trying to make a very complicated , fully remote wearable , so basically i am using my Arduino Pro as a ble Server that transmits Data via BLE to phone app, then the phone APP sends this DATA in HEX values to thingspeak channel where i ll Convert em to DEC values in order to graph them, then i neeed webviewer to show this graph .
As far as you can understand , i am programming in lower level microcontrollers and communicate one another , mobile APP is not a subject i am relevant with ,thats why i struggle alot here.

You were right Ewpatton and @ChrisWard UUID's are from UUID generator and they are completely correct.

they are analog Values that get converted to HEX values in the Gatt server , i know i placed int there , i just want to see how they ll get uploaded to thingspeak .
If it doesnt work , gonna use String for it , since thingspeak will save em HEX in string anyway.

Good to know the problem is solved. The real project sounds exciting, hope it all goes well. I would definitely use strings throughout.

Thank you man , this project is draining me slowly .
You might have any idea why i cant Scan BLE devices , i followed this example : http://iot.appinventor.mit.edu/assets/tutorials/MIT_App_Inventor_Basic_Connection.pdf

My phone is just scanning and scanning and scanning and Listviewer wont open , Location is enabled as well as bluetooth .

ecg_rose(1).aia (174.9 KB)

One other User recently had a similar issue, so we had the Address list populate a Blocks List under a Timer - that ensured the desired device was found but the List gets a lot of duplicates (easy enough to filter later if required). Once you have the address, so long as it's a fixed address, you can hard-code your App to connect directly, no scan required.

Below is code to generate a List of devices under a Timer. Ignore the connect to known device method because you can simply use the 'ConnectWithAddress' Block once the address is known (the string returned by App Inventor).

BLE_ConnectToKnownDevice.aia (192.8 KB)

1 Like

Hi Theodor!
You have a problem: in your listviewer, the background color is the same (white) as the foreground color. Therefore you do not see anything. So change your background color to blue or something, and it should work. With your .aia I could nicely connect to my micro:bit, after this change.
Your project sounds interesting!

2 Likes

Not only i managed to connect to my BLE , but i am now graphing real time the data my App sends to Thingspeak .
Readings are quite wrong because i guess i need to convert them from HEX.
I managed to connect with the example @ChrisWard provided .
I am going to try tomorrow with mine again and change color since its more simplistic (the other example spams alot of names), i also added couple more blocks to create lists and do some conversions.
Couldnt have made it without your help.

2 Likes

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