With reference to this issue #132
The crash message
JNI ERROR (app bug): expected jbyte but got value of 206 as argument 1 to void java.lang.Byte.(byte)
The crash message on android side showed that the received data from ros is unsigned byte (0-255) but the byte of java is signed (-128, 127).
Therefore, the proper way to solve this problem should be on android side to disable the check of data type.
https://android.googlesource.com/platform/art/+/master/runtime/reflection.cc line417
I have no idea to solve on android side but changed unit8[] data from http://docs.ros.org/en/noetic/api/sensor_msgs/html/msg/CompressedImage.html from to int8[] data and compile the ros2_java library again. The publish/subscribe of this message becomes normal without crash.
Is there alternative to solve this issue on Android side without changing the message type of CompressedImage?