I started programming an Android App for our robot. Therefore, I wanted to import some custom messages from our other C++ packages.
I successfully set up the Android Studio with android_cv_bridge, it even builds and runs on my phone.
However, I tried to import a custom message package, that I generated beforehand with genjava_message_artifacts. For that, I added in the build.gradle dependencies compile "org.ros.rosjava_messages:locomotion_controller_msgs:[0.0,0.2)" and in the source file import locomotion_controller_msgs.*;, but if I build the project with Android Studio, it cannot find locomotion_controller_msgs.
Error:(25, 1) error: package locomotion_controller_msgs does not exist
If I remove the import statement, it doesn’t complain, so I guess the compile command works fine, but it cannot import the package for some reasons.
I also checked the ROS_MAVEN_PATH which is /home/sam/catkin_ws/devel/share/maven:/opt/ros/indigo/share/maven where all the rosjava artifacts actually are.
Did I miss something? How else can I add custom messages to an ROS Android Studio project?
Hi Sam,
I am not sure I can fully understand your set-up. What is your catkin workspace layout? Do you have the Android cv_bridge package in the same catkin workspace as the custom message package or in a separate one?
When you say you generated the messages beforehand with genjava_message_artifacts, how exactly did you do that?
The artifact resolution from Android Studio si very simple, it will look for the artifact inside the maven repositories, which you can tell easily by the directory and file names. Did you check inside /home/sam/catkin_ws/devel/share/maven to see if the custom messages are there and with the right name?
I hope this helps bring more clarity.
Best,
Julian
~/catkin_ws/src : with all the C++ and msgs packages
than I have the android_cv_bridge package inside the git directory, I don’t think it needs to be in the workspace, because I build with Android Studio, what works without custom messages.
I generated the rosjava artifacts by running genjava_message_artifacts -p locomotion_controller_msgs inside /home/sam/catkin_ws
The custom message .jar file exists, the path looks like that: /home/sam/catkin_ws/devel/share/maven/org/ros/rosjava_messages/locomotion_controller_msgs/0.0.1/locomotion_controller_msgs-0.0.1.jar
Edit
I just tried to decompile the locomotion_controller_msgs-0.0.1.jar and there seems to be no class inside and the .jar file is only 437 bytes. If I do the same with e.g. std_msgs-0.5.9.jar I get a whole bunch of classes. Perhaps there is something wrong with my rosjava artifacts generation? What other ways than genjava_messages_artifacts are there for my setup?
So the reason was, that I build my catkin_ws with catkin build rather than catkin_make, obviously this has a bad effect on genjava_message_artifacts for some mysterious reasons. Is this issue known? Is there a solution for that or do I have to live with that?