I updated the Gradle plugin version from 3.3.2 to 3.4.0 and Gradle to version 5.1.1. I know for sure this causes a library to be unknown when I import it. It gives the error unresolved reference.

enter image description here

Cleaning the project, rebuilding, Invalidate caches/Restart and throwing away the .idea file all do not solve this issue. The only thing that worked for me was restoring the Gradle version back to 3.3.2. But this is not what I want.

The problem I have has to do with ROS libraries; ROS Java bootstrap's message_generation to be specific. This library has the same relative path as the rosjava library; namely org.ros.*. I am not sure if this has anything to do with the issue.

What can I do about this? Thanks a lot: all help is very welcome!

1 Answers

Klyner On

The solution was described on the Gradle github issue page where I also described my problem. What is described is that ROS is publishing the wrong metadata.

"This says that you only need the jar that contains org.ros.internal.message.Message when running your application and not when you're compiling it, which doesn't seem to be the case. To fix this, you'll need to add the extra dependencies that ROS isn't including for compilation."

I fixed it like described; I added the dependencies corresponding to the libraries that were not found after the update. This did the trick for me:

implementation 'org.ros.rosjava_messages:sensor_msgs:1.12.5'
implementation 'org.ros.rosjava_bootstrap:message_generation:0.3.3'
implementation 'org.ros.rosjava_messages:std_msgs:0.5.11'
implementation 'org.ros.rosjava_messages:geometry_msgs:1.12.7'