List error when use Bluetooth Low Energy (BLE) extension

1,760 views
Skip to first unread message
Assigned to ewpa...@gmail.com by ghica.va...@gmail.com

VBLUno51

unread,
Oct 28, 2017, 1:14:27 PM10/28/17
to MIT App Inventor Forum
Hi all,

I using MIT App Inventor2 to build an application that supports communication via Bluetooth Low Energy (BLE).
Everything is ok, but when I try to write bytes to BLE Device, I cannot. 
BluetoothLE.WriteBytes method have values argument with list format.

The error is: "Runtime error failed resolution Lcom/google/common/collect/List"

The below image is screen a part of my code.

Many thanks for your seeing!



Abraham Getzler

unread,
Oct 29, 2017, 1:27:42 PM10/29/17
to MIT App Inventor Forum
Could you post a complete Downloaded Blocks Image?

Maybe another part of your blocks is corrupting your list?

ABG

VBLUno51

unread,
Oct 29, 2017, 10:06:14 PM10/29/17
to MIT App Inventor Forum
Hi Abraham, many thanks for your attention.

I think that another parts of my blocks could work fine.

My blocks is attached in the below image.


gerrikoio

unread,
Oct 30, 2017, 9:15:54 AM10/30/17
to MIT App Inventor Forum
It's always worthwhile searching and reviewing old posts. This one, for example, should provide you with some help... "BLE Module Not Accepting List Argument for Value" 

VBLUno51

unread,
Oct 30, 2017, 11:26:46 AM10/30/17
to MIT App Inventor Forum
Hi gerrikoio, 

Thanks for your suggestion. I will do that at next post.

I could not modify the title of this post

VBLUno51

unread,
Oct 31, 2017, 8:13:38 AM10/31/17
to MIT App Inventor Forum
I have not fixed this problem yet.

gerrikoio

unread,
Oct 31, 2017, 11:44:21 AM10/31/17
to MIT App Inventor Forum
For now, use WriteStrings instead of WriteBytes. 

VBLUno51

unread,
Oct 31, 2017, 11:50:26 AM10/31/17
to MIT App Inventor Forum
I have just fixed the problem. 

To use BLE extensions for MIT AI2, must connect to AI Companion. 

When connect AI Companion, extension works fine. When use Build command, it did not works fine.

Many thanks for your seeing.
Message has been deleted
Message has been deleted
Message has been deleted

Ghica

unread,
Nov 1, 2017, 8:00:34 AM11/1/17
to mitappinv...@googlegroups.com
Why did your app not work when you build it?
Is there an error message you can post here?
Cheers, Ghica.

Robert Blaakmeer

unread,
Nov 1, 2017, 10:39:14 AM11/1/17
to MIT App Inventor Forum
The problem has been around for some time, I have the same. The error is: "Runtime Error - Failed resolution of: Lcom/google/common/collect/Lists;"
It happens when using any of the WriteBytes / WriteShorts / WriteIntegers operations

Ghica

unread,
Nov 2, 2017, 6:43:55 AM11/2/17
to mitappinv...@googlegroups.com
I have seen the other threads, but it is confusing that you do not refer to them in your earlier post. I think I have also seen that there is a newer version in the works that fixes this bug. Maybe Evan can comment.
For now, it should be possible to find a workaround.
Cheers, Ghica.

Dirk Loeckx

unread,
Nov 5, 2017, 3:33:36 AM11/5/17
to MIT App Inventor Forum
I think I am having the same problem, and don't know how I should use the work-around. My goal is to send exactly the bytes 02:64:0A and 02:68:0A. If I try to send them with WriteBytes, I get the list error in the apk. If I try to send the Bytes as a string, I get a ' Unable to convert' error. Is there a way to make a literal string with non-ascii characters and/or convert a list of bytes to a string?

Code that works in companion-app but not in apk:

Code that raises the 'Unable to convert 2 of type gnu.math.IntNum to type java.lang.String' error:



Any help would be appreciated!

Dirk Loeckx

unread,
Nov 5, 2017, 5:41:21 AM11/5/17
to MIT App Inventor Forum
I found a solution myself, thanks to http://ai2.appinventor.mit.edu/?galleryId=5926305773387776 . You can (ab)use the Web component to convert byte to char (obviously, you need to add a Web component (from Connectivity) to your Screen for this to work. Now I still have a trailing 00 to the string, yet luckily my device seems to ignore this.


Reply all
Reply to author
Forward
0 new messages