Android Question felUsbSerial v1.12 Error at random intervals ArrayIndexOutOfBoundsException, and lost characters

weighment

Member
Licensed User
Using felUsbSerial - v1.12 on Android 8.1 with FTDI PID 0x6010

The serial communication works for a variable length of time before an exception in the library.

Connecting to a serial device, requesting data from it every half second or so, data out is 10 or so characters, data in is usually 10 or so characters, occasionally 100 characters in a burst.
Randomly, anywhere from within 10 seconds of connection, to as long as 5 minutes later I get a Array index out of bounds error shown below. For the input buffer size, I see the "Default value is 16 * 1024", and this app has no where near enough data to overflow the buffer. (I doubled it to 32*1024 and still had the error) Is the buffer argument sent to the event only 60 bytes? In observation I never see it have more than 20 characters at a time sent to the event in normal operation of the app.

What is the best way to trap this exception and prevent it from taking down the app? Ideally I'd like to detect the error and recover.

Also, regularly losing 2 or three characters from messages. Occurs on a similar random interval. May or may not be related.

Is source code for this library available to help solve it?

B4X:
    Public usbserial As felUsbSerial

Error message:
java.lang.ArrayIndexOutOfBoundsException: length=61; index=61
    at com.felhr.usbserial.FTDISerialDevice$FTDIUtilities.copyData(FTDISerialDevice.java:594)
    at com.felhr.usbserial.FTDISerialDevice$FTDIUtilities.adaptArray(FTDISerialDevice.java:502)
    at com.felhr.usbserial.UsbSerialDevice$WorkerThread.run(UsbSerialDevice.java:248)
 

DonManfred

Expert
Licensed User
Longtime User
Hiding the Code you are using is a perfect way NOT TO GET help.
Hard to help if you do not provide any code.

Additional i thing the error is incomplete. Post the full stacktrace.
 
Last edited:
Upvote 0

weighment

Member
Licensed User
Thanks for the quick look. Will try to find more of a stack trace, but that is all that shows up in the log window.

Nothing hidden, but also nothing different from the example source. I connect like this:

initialization code:
                usbserial.Initialize("usbserial", device, usbSerialManager.GetDevices(useThisOne).InterfaceCount-1)
                usbserial.BaudRate = 115200
                usbserial.DataBits = usbserial.DATA_BITS_8
                usbserial.StartReading

and capture the event like this:
event handler:
Sub usbserial_DataAvailable (Buffer() As Byte)
    Dim msg As String
    msg = BytesToString(Buffer, 0, Buffer.Length, "UTF8")
     '  Log(Buffer.Length)  ' had this in to keep an eye on the length, never more than 20
    parse(msg)
end sub

It works until the error that occurs inside the library.

For what it is worth, in the 20 or so times I have seen it, it is always that same "length=61; index=61" in the exception
 
Last edited:
Upvote 0

weighment

Member
Licensed User
I thought the third argument was the length in bytes, not the end byte.

1722151963443.png

(forgive the image above, could not figure out how to pull that popup tip into text)

I did try it though, but that cuts off the last character of every inbound message.
 

Attachments

  • 1722151909520.png
    1722151909520.png
    26.1 KB · Views: 62
Upvote 0

emexes

Expert
Licensed User
Can you move the parse(msg) to outside of the DataAvailable event handler?

Perhaps the parsing is sometimes taking an abnormal amount of time (garbage collection?) and more data is arriving whilst the DataAvailable event handler is still digesting the previous event...

If you comment out the parse(msg) call, does the communication continue anyway? (as in: maybe it doesn't continue, if the next packet is requested by the parse(msg) call) And if it does, does the out-of-bounds error still occur?
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
more data is arriving whilst the DataAvailable event handler is still digesting the previous event...
Can't happen. The DataAvailable events always run on the main thread and will not be re-entered. If a new event is raised by the receiving thread it will be queued in the message loop till the running DataAvailable event returns to the message loop and the new event then raised..
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
I think it's this problem.
specifically this at post #31
 
Upvote 0

weighment

Member
Licensed User
Wow, great find @agraham, *exact* same issue from 5 years ago. I too am using a similar newer FTDI chip. At the risk of resurrecting an old post, I would love to know how @FredBerlin ever solved it.

For now I'm stuck tolerating the occasional two character loss, but the harder part short term is recovering from the less frequent ArrayIndexOutOfBoundsException in the library. Not sure how to catch and recover from an exception in the library that may have left that port in a bad state. Supposing I would close and reconnect that serial port. This part likely belongs in another thread.

Meanwhile I'll need to wait to see if whoever maintains felUSBSerial can bump that array size to 512 or share the source. (is that @Erel ?)

Or I find a working USB serial Java library and learn how to wrap it using Erel's "Simple Library Compiler" and your batch file method.

Either way, many thanks for locating the root cause that advances things toward a solution.
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
Erel wrote the library to wrap a GitHub project. I've had a poke around inside and it doesn't seem to be just a simple resize of an array as there seems to be a lot of passing arrays around and I haven't found the mother lode that unequivocally defines the buffer size. There is logic in there that needs a bit of unraveling to make sure that the change is safe in all circumstances. As was noted in the post #31 that I linked to, the library should really interrogate the device for it's max packet size and then use that.
 
Upvote 0

weighment

Member
Licensed User
Theory: This issue may have been solved in the updated original library that felUSBserial was derived from, and it just needs to be rewrapped using the latest version.

I'm glad to do it if I knew what I was doing with the "Simple Library Compiler" (I will soon!)

Support for the theory: the exception is in adaptArray, specifically in copyData, and the latest version includes a comment that FTDI devices need special treatment.

from github.com/felHR85/UsbSerial/blob/master/usbserial/src/main/java/com/felhr/usbserial/FTDISerialDevice.java

library source function that creates the exception:
        // Special treatment needed to FTDI devices
        public byte[] adaptArray(byte[] ftdiData)
        {
            int length = ftdiData.length;
            if(length > 64)
            {
                int n = 1;
                int p = 64;
                // Precalculate length without FTDI headers
                while(p < length)
                {
                    n++;
                    p = n*64;
                }
                int realLength = length - n*2;
                byte[] data = new byte[realLength];
                copyData(ftdiData, data);
                return data;
            }else
            {
                return Arrays.copyOfRange(ftdiData, 2, length);
            }
        }

        }

The unknown is whether this special treatment was in there when felUSBserial was built 5 years ago, as this source file was modified 3 years ago. Would like to know a way to find out what version a given B4X library was wrapped around, but guessing from the time line of release it could not be the current latest.
 
Upvote 0

weighment

Member
Licensed User
Erel wrote the library to wrap a GitHub project. I've had a poke around inside and it doesn't seem to be just a simple resize of an array as there seems to be a lot of passing arrays around and I haven't found the mother lode that unequivocally defines the buffer size. There is logic in there that needs a bit of unraveling to make sure that the change is safe in all circumstances. As was noted in the post #31 that I linked to, the library should really interrogate the device for it's max packet size and then use that.
Agreed. Did some poking to see that it breaks up the message in two if larger than 64 bytes, but strangely creates the error with an index of 61 in a 60 byte array.
 
Upvote 0

weighment

Member
Licensed User
Many thanks @Erel

I do see a change in the newer underlying felHR85 code in FTDIUtilities.copyData that just might fix it.

existing copydata in B4A library:
// Copy data without FTDI headers
        private void copyData(byte[] src, byte[] dst)
        {
            int i = 0; // src index
            int j = 0; // dst index
            while(i <= src.length-1)
            {
                if(i != 0 && i != 1)
                {
                    if(i % 64 == 0 && i >= 64)
                    {
                        i += 2;
                    }else
                    {
                        dst[j] = src[i];
                        i++;
                        j++;
                    }
                }else
                {
                    i++;
                }
            }
        }
    }

new copydata from later felhr:
// Copy data without FTDI headers
    private static void copyData(byte[] src, byte[] dst)
    {
        int srcPos = 2, dstPos = 0;
        while(srcPos - 2 <= src.length - 64)
        {
            System.arraycopy(src, srcPos, dst, dstPos, 62);
            srcPos += 64;
            dstPos += 62;
        }
        int remaining = src.length - srcPos + 2;
        if (remaining > 0)
        {
            System.arraycopy(src, srcPos, dst, dstPos, remaining - 2);
        }
    }

Have not pulled in the new function yet, but I went to rebuild the library from source and get this from SLC v1.13:
error from SLC 1.13:
Starting step: Compiling Java code.
javac 1.8.0_401
C:\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\anywheresoftware\b4a\objects\usb\felUsbSerial.java:35: error: package anywheresoftware.b4a.objects.usb.UsbManagerWrapper does not exist
import anywheresoftware.b4a.objects.usb.UsbManagerWrapper.UsbDeviceWrapper;
                                                         ^


Error.

The FTDI special handling deletes two character headers. When it occasionally drops characters it always drops exactly two characters, and it happens more when larger bursts arrive. There is also an exact boundary value that likely treats the second block as if there are characters but there are none, creating the less frequent ArrayIndexOutOfBoundsException. I think if the buffer holds more than 64 data bytes it will lose two bytes, if it contains exactly 65 (or 66?) bytes it will generate an exception.

Hoping a rebuild with the latest felHR code fixes it.

I'll keep chasing it if I can get the library to build.
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
UsbDeviceWrapper is in the USB.jar internal library in C:\Program Files\Anywhere Software\B4A\Libraries\

I'm very rusty on this and can't remember whether SLC knows about the internal libraries or not, though it appears not, so you may need to make a 'libs' folder next to the 'src' folder in your SLC library project and copy USB.jar there.
 
Upvote 0

weighment

Member
Licensed User
This is chasing the SLC rabbit, but if feels in context with the ultimate solution. I should likely start a new thread, but here goes:

attempt 1:
Same original error whether using the Java 8 or 11 javac.exe

attempt 2:
Added the lib folder next to src folder with that Usb.jar, didn't solve it. (worth a shot though)

attempt 3:
I did add the path to the Usb.jar into the .class file at the project root but it did not solve it.

.class file:
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry kind="src" path="src"/>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
    <classpathentry kind="lib" path="C:/Paul/dev/Android/platforms/android-33/android.jar"/>
    <classpathentry kind="lib" path="C:/Program Files/Anywhere Software/B4A/Libraries/B4AShared.jar"/>
    <classpathentry kind="lib" path="C:/Program Files/Anywhere Software/B4A/Libraries/Core.jar"/>
    <classpathentry kind="lib" path="C:/Program Files/Anywhere Software/B4A/Libraries/Usb.jar"/>
    <classpathentry kind="output" path="bin"/>
</classpath>


progress:
I added these source files from the usb jar into the same project folder:
\src\anywheresoftware\b4a\objects\usb\UsbManagerWrapper.java
\src\anywheresoftware\b4a\objects\usb\MtpDeviceWrapper.java
\src\anywheresoftware\b4a\objects\usb\UsbDeviceConnectionWrapper.java

And it now using javac 11 it builds the jar and the xml file in the additional libraries, but generated a flurry of errors I'm not sure I can ignore.

SLC error using javac 11:
Starting step: Compiling Java code.
javac 11.0.1

Completed successfully.
Starting step: Creating jar file.
Completed successfully.
Starting step: Creating XML file.
javadoc: warning - The old Doclet and Taglet APIs in the packages
com.sun.javadoc, com.sun.tools.doclets and their implementations
are planned to be removed in a future JDK release. These
components have been superseded by the new APIs in jdk.javadoc.doclet.
Users are strongly recommended to migrate to the new APIs.
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\anywheresoftware\b4a\objects\usb\felUsbSerial.java:25: error: package android.content does not exist
import android.content.Context;
                      ^
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\anywheresoftware\b4a\objects\usb\felUsbSerial.java:26: error: package android.hardware.usb does not exist
import android.hardware.usb.UsbDevice;
                           ^
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\anywheresoftware\b4a\objects\usb\felUsbSerial.java:27: error: package android.hardware.usb does not exist
import android.hardware.usb.UsbDeviceConnection;
                           ^
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\anywheresoftware\b4a\objects\usb\felUsbSerial.java:28: error: package android.hardware.usb does not exist
import android.hardware.usb.UsbManager;
                           ^
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\anywheresoftware\b4a\objects\usb\UsbManagerWrapper.java:24: error: package android.app does not exist
import android.app.PendingIntent;
                  ^
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\anywheresoftware\b4a\objects\usb\UsbManagerWrapper.java:25: error: package android.content does not exist
import android.content.Context;
                      ^
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\anywheresoftware\b4a\objects\usb\UsbManagerWrapper.java:26: error: package android.content does not exist
import android.content.Intent;
                      ^
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\anywheresoftware\b4a\objects\usb\UsbManagerWrapper.java:27: error: package android.hardware.usb does not exist
import android.hardware.usb.UsbAccessory;
                           ^
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\anywheresoftware\b4a\objects\usb\UsbManagerWrapper.java:28: error: package android.hardware.usb does not exist
import android.hardware.usb.UsbDevice;
                           ^
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\anywheresoftware\b4a\objects\usb\UsbManagerWrapper.java:29: error: package android.hardware.usb does not exist
import android.hardware.usb.UsbDeviceConnection;
                           ^
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\anywheresoftware\b4a\objects\usb\UsbManagerWrapper.java:30: error: package android.hardware.usb does not exist
import android.hardware.usb.UsbEndpoint;
                           ^
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\anywheresoftware\b4a\objects\usb\UsbManagerWrapper.java:31: error: package android.hardware.usb does not exist
import android.hardware.usb.UsbInterface;
                           ^
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\anywheresoftware\b4a\objects\usb\UsbManagerWrapper.java:32: error: package android.hardware.usb does not exist
import android.hardware.usb.UsbManager;
                           ^
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\anywheresoftware\b4a\objects\usb\UsbManagerWrapper.java:33: error: package android.os does not exist
import android.os.Build;
                 ^
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\anywheresoftware\b4a\objects\usb\UsbManagerWrapper.java:34: error: package android.os does not exist
import android.os.ParcelFileDescriptor;
                 ^
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\com\felhr\usbserial\UsbSerialDevice.java:15: error: package android.hardware.usb does not exist
import android.hardware.usb.UsbConstants;
                           ^
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\com\felhr\usbserial\UsbSerialDevice.java:16: error: package android.hardware.usb does not exist
import android.hardware.usb.UsbDevice;
                           ^
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\com\felhr\usbserial\UsbSerialDevice.java:17: error: package android.hardware.usb does not exist
import android.hardware.usb.UsbDeviceConnection;
                           ^
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\com\felhr\usbserial\UsbSerialDevice.java:18: error: package android.hardware.usb does not exist
import android.hardware.usb.UsbEndpoint;
                           ^
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\com\felhr\usbserial\UsbSerialDevice.java:19: error: package android.hardware.usb does not exist
import android.hardware.usb.UsbInterface;
                           ^
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\com\felhr\usbserial\UsbSerialDevice.java:20: error: package android.hardware.usb does not exist
import android.hardware.usb.UsbRequest;
                           ^
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\anywheresoftware\b4a\objects\usb\felUsbSerial.java:43: error: cannot find symbol
    public UsbManager usbManager;
           ^
  symbol:   class UsbManager
  location: class felUsbSerial
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\anywheresoftware\b4a\objects\usb\felUsbSerial.java:78: error: cannot find symbol
    public void Initialize(String EventName, UsbDevice Device, int InterfaceIndex) throws Exception{
                                             ^
  symbol:   class UsbDevice
  location: class felUsbSerial
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\anywheresoftware\b4a\objects\usb\felUsbSerial.java:86: error: cannot find symbol
    public void Initialize2(String EventName, UsbDevice Device, int InterfaceIndex, String ClassName) throws Exception {
                                              ^
  symbol:   class UsbDevice
  location: class felUsbSerial
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\com\felhr\usbserial\UsbSerialDevice.java:28: error: cannot find symbol
    protected final UsbDevice device;
                    ^
  symbol:   class UsbDevice
  location: class UsbSerialDevice
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\com\felhr\usbserial\UsbSerialDevice.java:29: error: cannot find symbol
    protected final UsbDeviceConnection connection;
                    ^
  symbol:   class UsbDeviceConnection
  location: class UsbSerialDevice
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\com\felhr\usbserial\UsbSerialDevice.java:40: error: cannot find symbol
    private UsbEndpoint inEndpoint;
            ^
  symbol:   class UsbEndpoint
  location: class UsbSerialDevice
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\com\felhr\usbserial\UsbSerialDevice.java:41: error: cannot find symbol
    private UsbEndpoint outEndpoint;
            ^
  symbol:   class UsbEndpoint
  location: class UsbSerialDevice
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\com\felhr\usbserial\UsbSerialDevice.java:54: error: cannot find symbol
    public UsbSerialDevice(UsbDevice device, UsbDeviceConnection connection)
                           ^
  symbol:   class UsbDevice
  location: class UsbSerialDevice
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\com\felhr\usbserial\UsbSerialDevice.java:54: error: cannot find symbol
    public UsbSerialDevice(UsbDevice device, UsbDeviceConnection connection)
                                             ^
  symbol:   class UsbDeviceConnection
  location: class UsbSerialDevice
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\com\felhr\usbserial\UsbSerialDevice.java:62: error: cannot find symbol
    public static UsbSerialDevice createUsbSerialDevice(UsbDevice device, UsbDeviceConnection connection)
                                                        ^
  symbol:   class UsbDevice
  location: class UsbSerialDevice
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\com\felhr\usbserial\UsbSerialDevice.java:62: error: cannot find symbol
    public static UsbSerialDevice createUsbSerialDevice(UsbDevice device, UsbDeviceConnection connection)
                                                                          ^
  symbol:   class UsbDeviceConnection
  location: class UsbSerialDevice
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\com\felhr\usbserial\UsbSerialDevice.java:67: error: cannot find symbol
    public static UsbSerialDevice createUsbSerialDevice(UsbDevice device, UsbDeviceConnection connection, int iface)
                                                        ^
  symbol:   class UsbDevice
  location: class UsbSerialDevice
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\com\felhr\usbserial\UsbSerialDevice.java:67: error: cannot find symbol
    public static UsbSerialDevice createUsbSerialDevice(UsbDevice device, UsbDeviceConnection connection, int iface)
                                                                          ^
  symbol:   class UsbDeviceConnection
  location: class UsbSerialDevice
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\com\felhr\usbserial\UsbSerialDevice.java:91: error: cannot find symbol
    public static boolean isSupported(UsbDevice device)
                                      ^
  symbol:   class UsbDevice
  location: class UsbSerialDevice
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\com\felhr\usbserial\UsbSerialDevice.java:203: error: cannot find symbol
    public static boolean isCdcDevice(UsbDevice device)
                                      ^
  symbol:   class UsbDevice
  location: class UsbSerialDevice
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\com\felhr\usbserial\UsbSerialDevice.java:399: error: cannot find symbol
    protected void setSyncParams(UsbEndpoint inEndpoint, UsbEndpoint outEndpoint)
                                 ^
  symbol:   class UsbEndpoint
  location: class UsbSerialDevice
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\com\felhr\usbserial\UsbSerialDevice.java:399: error: cannot find symbol
    protected void setSyncParams(UsbEndpoint inEndpoint, UsbEndpoint outEndpoint)
                                                         ^
  symbol:   class UsbEndpoint
  location: class UsbSerialDevice
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\com\felhr\usbserial\UsbSerialDevice.java:405: error: cannot find symbol
    protected void setThreadsParams(UsbRequest request, UsbEndpoint endpoint)
                                    ^
  symbol:   class UsbRequest
  location: class UsbSerialDevice
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\com\felhr\usbserial\UsbSerialDevice.java:405: error: cannot find symbol
    protected void setThreadsParams(UsbRequest request, UsbEndpoint endpoint)
                                                        ^
  symbol:   class UsbEndpoint
  location: class UsbSerialDevice
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\com\felhr\usbserial\UsbSerialDevice.java:331: error: cannot find symbol
        private UsbEndpoint inEndpoint;
                ^
  symbol:   class UsbEndpoint
  location: class UsbSerialDevice.ReadThread
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\com\felhr\usbserial\UsbSerialDevice.java:382: error: cannot find symbol
        public void setUsbEndpoint(UsbEndpoint inEndpoint)
                                   ^
  symbol:   class UsbEndpoint
  location: class UsbSerialDevice.ReadThread
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\com\felhr\usbserial\UsbSerialDevice.java:297: error: cannot find symbol
        private UsbEndpoint outEndpoint;
                ^
  symbol:   class UsbEndpoint
  location: class UsbSerialDevice.WriteThread
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\com\felhr\usbserial\UsbSerialDevice.java:315: error: cannot find symbol
        public void setUsbEndpoint(UsbEndpoint outEndpoint)
                                   ^
  symbol:   class UsbEndpoint
  location: class UsbSerialDevice.WriteThread
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\com\felhr\usbserial\UsbSerialDevice.java:224: error: cannot find symbol
        private UsbRequest requestIN;
                ^
  symbol:   class UsbRequest
  location: class UsbSerialDevice.WorkerThread
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\com\felhr\usbserial\UsbSerialDevice.java:273: error: cannot find symbol
        public void setUsbRequest(UsbRequest request)
                                  ^
  symbol:   class UsbRequest
  location: class UsbSerialDevice.WorkerThread
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\com\felhr\usbserial\UsbSerialDevice.java:278: error: cannot find symbol
        public UsbRequest getUsbRequest()
               ^
  symbol:   class UsbRequest
  location: class UsbSerialDevice.WorkerThread
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\anywheresoftware\b4a\objects\usb\UsbManagerWrapper.java:50: error: cannot find symbol
    private UsbManager manager;
            ^
  symbol:   class UsbManager
  location: class UsbManagerWrapper
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\anywheresoftware\b4a\objects\usb\UsbManagerWrapper.java:185: error: cannot find symbol
    public static class UsbDeviceWrapper extends AbsObjectWrapper<UsbDevice> {
                                                                  ^
  symbol:   class UsbDevice
  location: class UsbManagerWrapper
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\anywheresoftware\b4a\objects\usb\UsbManagerWrapper.java:138: error: cannot find symbol
    public UsbDeviceConnectionWrapper OpenDevice(UsbDevice Device, UsbInterface Interface, boolean ForceClaim) {
                                                 ^
  symbol:   class UsbDevice
  location: class UsbManagerWrapper
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\anywheresoftware\b4a\objects\usb\UsbManagerWrapper.java:138: error: cannot find symbol
    public UsbDeviceConnectionWrapper OpenDevice(UsbDevice Device, UsbInterface Interface, boolean ForceClaim) {
                                                                   ^
  symbol:   class UsbInterface
  location: class UsbManagerWrapper
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\anywheresoftware\b4a\objects\usb\UsbDeviceConnectionWrapper.java:24: error: package android.hardware.usb does not exist
import android.hardware.usb.UsbConstants;
                           ^
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\anywheresoftware\b4a\objects\usb\UsbDeviceConnectionWrapper.java:25: error: package android.hardware.usb does not exist
import android.hardware.usb.UsbDeviceConnection;
                           ^
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\anywheresoftware\b4a\objects\usb\UsbDeviceConnectionWrapper.java:26: error: package android.hardware.usb does not exist
import android.hardware.usb.UsbEndpoint;
                           ^
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\anywheresoftware\b4a\objects\usb\UsbDeviceConnectionWrapper.java:27: error: package android.hardware.usb does not exist
import android.hardware.usb.UsbInterface;
                           ^
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\anywheresoftware\b4a\objects\usb\UsbDeviceConnectionWrapper.java:28: error: package android.hardware.usb does not exist
import android.hardware.usb.UsbRequest;
                           ^
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\anywheresoftware\b4a\objects\usb\UsbManagerWrapper.java:162: error: cannot find symbol
    public void RequestPermission(UsbDevice Device) {
                                  ^
  symbol:   class UsbDevice
  location: class UsbManagerWrapper
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\anywheresoftware\b4a\objects\usb\UsbManagerWrapper.java:177: error: cannot find symbol
    public boolean HasPermission(UsbDevice Device) {
                                 ^
  symbol:   class UsbDevice
  location: class UsbManagerWrapper
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\anywheresoftware\b4a\objects\usb\UsbDeviceConnectionWrapper.java:51: error: cannot find symbol
    UsbDeviceConnection connection;
    ^
  symbol:   class UsbDeviceConnection
  location: class UsbDeviceConnectionWrapper
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\anywheresoftware\b4a\objects\usb\UsbDeviceConnectionWrapper.java:52: error: cannot find symbol
    UsbInterface usbInterface;
    ^
  symbol:   class UsbInterface
  location: class UsbDeviceConnectionWrapper
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\anywheresoftware\b4a\objects\usb\UsbDeviceConnectionWrapper.java:137: error: cannot find symbol
    public int BulkTransfer (UsbEndpoint Endpoint, byte[] Buffer, int Length, int Timeout) {
                             ^
  symbol:   class UsbEndpoint
  location: class UsbDeviceConnectionWrapper
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\anywheresoftware\b4a\objects\usb\UsbManagerWrapper.java:231: error: cannot find symbol
        public UsbInterface GetInterface(int Index) {
               ^
  symbol:   class UsbInterface
  location: class UsbDeviceWrapper
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\anywheresoftware\b4a\objects\usb\UsbManagerWrapper.java:324: error: cannot find symbol
        UsbAccessory accessory;
        ^
  symbol:   class UsbAccessory
  location: class UsbAccessoryWrapper
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\anywheresoftware\b4a\objects\usb\UsbManagerWrapper.java:325: error: cannot find symbol
        private ParcelFileDescriptor pfd;
                ^
  symbol:   class ParcelFileDescriptor
  location: class UsbAccessoryWrapper
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\anywheresoftware\b4a\objects\usb\MtpDeviceWrapper.java:20: error: package android.hardware.usb does not exist
import android.hardware.usb.UsbConstants;
                           ^
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\anywheresoftware\b4a\objects\usb\MtpDeviceWrapper.java:21: error: package android.hardware.usb does not exist
import android.hardware.usb.UsbDevice;
                           ^
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\anywheresoftware\b4a\objects\usb\MtpDeviceWrapper.java:22: error: package android.hardware.usb does not exist
import android.hardware.usb.UsbDeviceConnection;
                           ^
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\anywheresoftware\b4a\objects\usb\MtpDeviceWrapper.java:23: error: package android.mtp does not exist
import android.mtp.MtpDevice;
                  ^
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\anywheresoftware\b4a\objects\usb\MtpDeviceWrapper.java:24: error: package android.mtp does not exist
import android.mtp.MtpObjectInfo;
                  ^
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\anywheresoftware\b4a\objects\usb\MtpDeviceWrapper.java:25: error: package android.mtp does not exist
import android.mtp.MtpStorageInfo;
                  ^
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\anywheresoftware\b4a\objects\usb\MtpDeviceWrapper.java:31: error: cannot find symbol
public class MtpDeviceWrapper extends AbsObjectWrapper<MtpDevice>{
                                                       ^
  symbol: class MtpDevice
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\anywheresoftware\b4a\objects\usb\MtpDeviceWrapper.java:32: error: cannot find symbol
    public void Initialize(String EventName, UsbDevice UsbDevice) {
                                             ^
  symbol:   class UsbDevice
  location: class MtpDeviceWrapper
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\anywheresoftware\b4a\objects\usb\UsbDeviceConnectionWrapper.java:196: error: cannot find symbol
    public static class UsbRequestWrapper extends AbsObjectWrapper<UsbRequest>{
                                                                   ^
  symbol:   class UsbRequest
  location: class UsbDeviceConnectionWrapper
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\anywheresoftware\b4a\objects\usb\UsbDeviceConnectionWrapper.java:202: error: cannot find symbol
        public void Initialize(UsbDeviceConnectionWrapper Connection, UsbEndpoint Endpoint) {
                                                                      ^
  symbol:   class UsbEndpoint
  location: class UsbRequestWrapper
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\anywheresoftware\b4a\objects\usb\UsbManagerWrapper.java:275: error: cannot find symbol
    public static class UsbEndpointWrapper extends AbsObjectWrapper<UsbEndpoint> {
                                                                    ^
  symbol:   class UsbEndpoint
  location: class UsbManagerWrapper
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\anywheresoftware\b4a\objects\usb\UsbManagerWrapper.java:239: error: cannot find symbol
    public static class UsbInterfaceWrapper extends AbsObjectWrapper<UsbInterface> {
                                                                     ^
  symbol:   class UsbInterface
  location: class UsbManagerWrapper
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\com\felhr\usbserial\BLED112SerialDevice.java:9: error: package android.hardware.usb does not exist
import android.hardware.usb.UsbConstants;
                           ^
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\com\felhr\usbserial\BLED112SerialDevice.java:10: error: package android.hardware.usb does not exist
import android.hardware.usb.UsbDevice;
                           ^
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\com\felhr\usbserial\BLED112SerialDevice.java:11: error: package android.hardware.usb does not exist
import android.hardware.usb.UsbDeviceConnection;
                           ^
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\com\felhr\usbserial\BLED112SerialDevice.java:12: error: package android.hardware.usb does not exist
import android.hardware.usb.UsbEndpoint;
                           ^
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\com\felhr\usbserial\BLED112SerialDevice.java:13: error: package android.hardware.usb does not exist
import android.hardware.usb.UsbInterface;
                           ^
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\com\felhr\usbserial\BLED112SerialDevice.java:14: error: package android.hardware.usb does not exist
import android.hardware.usb.UsbRequest;
                           ^
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\com\felhr\usbserial\BLED112SerialDevice.java:15: error: package android.util does not exist
import android.util.Log;
                   ^
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\com\felhr\usbserial\BLED112SerialDevice.java:50: error: cannot find symbol
    private UsbInterface mInterface;
            ^
  symbol:   class UsbInterface
  location: class BLED112SerialDevice
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\com\felhr\usbserial\BLED112SerialDevice.java:51: error: cannot find symbol
    private UsbEndpoint inEndpoint;
            ^
  symbol:   class UsbEndpoint
  location: class BLED112SerialDevice
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\com\felhr\usbserial\BLED112SerialDevice.java:52: error: cannot find symbol
    private UsbEndpoint outEndpoint;
            ^
  symbol:   class UsbEndpoint
  location: class BLED112SerialDevice
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\com\felhr\usbserial\BLED112SerialDevice.java:53: error: cannot find symbol
    private UsbRequest requestIN;
            ^
  symbol:   class UsbRequest
  location: class BLED112SerialDevice
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\com\felhr\usbserial\BLED112SerialDevice.java:56: error: cannot find symbol
    public BLED112SerialDevice(UsbDevice device, UsbDeviceConnection connection)
                               ^
  symbol:   class UsbDevice
  location: class BLED112SerialDevice
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\com\felhr\usbserial\BLED112SerialDevice.java:56: error: cannot find symbol
    public BLED112SerialDevice(UsbDevice device, UsbDeviceConnection connection)
                                                 ^
  symbol:   class UsbDeviceConnection
  location: class BLED112SerialDevice
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\com\felhr\usbserial\CDCSerialDevice.java:9: error: package android.hardware.usb does not exist
import android.hardware.usb.UsbConstants;
                           ^
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\com\felhr\usbserial\CDCSerialDevice.java:10: error: package android.hardware.usb does not exist
import android.hardware.usb.UsbDevice;
                           ^
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\com\felhr\usbserial\CDCSerialDevice.java:11: error: package android.hardware.usb does not exist
import android.hardware.usb.UsbDeviceConnection;
                           ^
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\com\felhr\usbserial\CDCSerialDevice.java:12: error: package android.hardware.usb does not exist
import android.hardware.usb.UsbEndpoint;
                           ^
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\com\felhr\usbserial\CDCSerialDevice.java:13: error: package android.hardware.usb does not exist
import android.hardware.usb.UsbInterface;
                           ^
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\com\felhr\usbserial\CDCSerialDevice.java:14: error: package android.hardware.usb does not exist
import android.hardware.usb.UsbRequest;
                           ^
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\com\felhr\usbserial\CDCSerialDevice.java:15: error: package android.util does not exist
import android.util.Log;
                   ^
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\com\felhr\usbserial\CDCSerialDevice.java:49: error: cannot find symbol
    private UsbInterface mInterface;
            ^
  symbol:   class UsbInterface
  location: class CDCSerialDevice
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\com\felhr\usbserial\CDCSerialDevice.java:50: error: cannot find symbol
    private UsbEndpoint inEndpoint;
            ^
  symbol:   class UsbEndpoint
  location: class CDCSerialDevice
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\com\felhr\usbserial\CDCSerialDevice.java:51: error: cannot find symbol
    private UsbEndpoint outEndpoint;
            ^
  symbol:   class UsbEndpoint
  location: class CDCSerialDevice
C:\Users\pbjun\OneDrive\dev\b4a\projects\Libraries\Libraries\felUsbSerial\src\com\felhr\usbserial\CDCSerialDevice.java:52: error: cannot find symbol
    private UsbRequest requestIN;
            ^
  symbol:   class UsbRequest
  location: class CDCSerialDevice
java.lang.RuntimeException: Only one version is allowed.
    at BADoclet.writeClass(BADoclet.java:69)
    at BADoclet.start(BADoclet.java:415)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at jdk.javadoc/com.sun.tools.javadoc.main.DocletInvoker.invoke(DocletInvoker.java:333)
    at jdk.javadoc/com.sun.tools.javadoc.main.DocletInvoker.start(DocletInvoker.java:212)
    at jdk.javadoc/com.sun.tools.javadoc.main.Start.parseAndExecute(Start.java:446)
    at jdk.javadoc/com.sun.tools.javadoc.main.Start.begin(Start.java:238)
    at jdk.javadoc/com.sun.tools.javadoc.main.Start.begin(Start.java:224)
    at jdk.javadoc/com.sun.tools.javadoc.Main.execute(Main.java:174)
    at jdk.javadoc/jdk.javadoc.internal.tool.Start.begin(Start.java:419)
    at jdk.javadoc/jdk.javadoc.internal.tool.Start.begin(Start.java:344)
    at jdk.javadoc/jdk.javadoc.internal.tool.Main.execute(Main.java:63)
    at jdk.javadoc/jdk.javadoc.internal.tool.Main.main(Main.java:52)

Error.

The built library does not parse, guessing the XML is bad

Screenshot 2024-07-31 092949.png


It would not build at all using javac 8 ( maybe somehow I need to build the jar with 11 and the xml with 8)

SLC error using javac 8:
Starting step: Compiling Java code.
javac 1.8.0_401
An exception has occurred in the compiler (1.8.0_401). Please file a bug against the Java compiler via the Java bug reporting page (http://bugreport.java.com) after checking the Bug Database (http://bugs.java.com) for duplicates. Include your program and the following diagnostic in your report. Thank you.
java.lang.AssertionError: annotationType(): unrecognized Attribute name MODULE (class com.sun.tools.javac.util.SharedNameTable$NameImpl)
    at com.sun.tools.javac.util.Assert.error(Assert.java:133)
    at com.sun.tools.javac.code.TypeAnnotations.annotationType(TypeAnnotations.java:231)
    at com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.separateAnnotationsKinds(TypeAnnotations.java:294)
    at com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.visitMethodDef(TypeAnnotations.java:1063)
    at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:778)
    at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
    at com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.scan(TypeAnnotations.java:275)
    at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:57)
    at com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.visitClassDef(TypeAnnotations.java:1042)
    at com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:693)
    at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
    at com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.scan(TypeAnnotations.java:275)
    at com.sun.tools.javac.code.TypeAnnotations$1.run(TypeAnnotations.java:127)
    at com.sun.tools.javac.comp.Annotate.flush(Annotate.java:152)
    at com.sun.tools.javac.comp.Annotate.enterDone(Annotate.java:129)
    at com.sun.tools.javac.comp.Enter.complete(Enter.java:512)
    at com.sun.tools.javac.comp.Enter.main(Enter.java:471)
    at com.sun.tools.javac.main.JavaCompiler.enterTrees(JavaCompiler.java:982)
    at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:857)
    at com.sun.tools.javac.main.Main.compile(Main.java:523)
    at com.sun.tools.javac.main.Main.compile(Main.java:381)
    at com.sun.tools.javac.main.Main.compile(Main.java:370)
    at com.sun.tools.javac.main.Main.compile(Main.java:361)
    at com.sun.tools.javac.Main.compile(Main.java:56)
    at com.sun.tools.javac.Main.main(Main.java:42)


Error.
 
Upvote 0
Top