ihmc-java-ros2-communication
ihmc-java-ros2-communication copied to clipboard
No implementation found for swig_module_init()
Hello, Recently, I've tried to integrate your library to my project following the README file. The project is being built and deployed successfully. However, I receive runtime error (part of logcat below):
Cannot load library us/ihmc/rtps/impl/fastRTPS/Linux/aarch64/libFastRTPSWrapper.so
No implementation found for void us.ihmc.rtps.impl.fastRTPS.FastRTPSJNI.swig_module_init() (tried Java_us_ihmc_rtps_impl_fastRTPS_FastRTPSJNI_swig_1module_1init and Java_us_ihmc_rtps_impl_fastRTPS_FastRTPSJNI_swig_1module_1init__)
What I've done:
- Created new empty project in Android Studio
- Added following lines to build.gradle (that log4j exclusion was necessary due to conflicts with other packages):
implementation('us.ihmc:ihmc-ros2-library:0.22.2'){
exclude group: 'org.apache.logging.log4j'
} // publish/subscribe API
implementation ('us.ihmc:ros2-common-interfaces:0.22.2'){
exclude group: 'org.apache.logging.log4j'
} // ROS2 common message library
- Modified MainActivity.kt:
package com.robocoon.robocoonmobileapp
import android.os.Bundle
import android.util.Log
import androidx.appcompat.app.AppCompatActivity
import std_msgs.msg.dds.Int64
import std_msgs.msg.dds.Int64PubSubType
import us.ihmc.pubsub.impl.fastRTPS.FastRTPSDomain
import us.ihmc.ros2.ROS2Node
import us.ihmc.ros2.ROS2PublisherBasics
import java.util.*
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
node = ROS2Node(FastRTPSDomain.getInstance(false),"TestNode")
pub = node.createPublisher(Int64PubSubType(), "test_topic")
Timer().schedule(object: TimerTask() {
override fun run() {
Log.d("Activity", "Publishing value: $pubVal")
val message = Int64();
message.data = pubVal;
pub.publish(message)
pubVal++
}
}, 0, 400)
}
var pubVal: Long = 0
lateinit var node: ROS2Node
lateinit var pub: ROS2PublisherBasics<Int64>
}
I've tried several things to overcome that:
-
FastRTPSDomain.getInstance(true)instead offalse. Then I'm receiving:java.lang.UnsatisfiedLinkError: dlopen failed: library "libFastRTPSWrapper.so" not found -
Using
IntraProcessDomaininstead ofFastRTPSDomain. Here I'm receiving:java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/logging/log4j/LogManager; -
Installing FastRTPS from source (with no success - it overwhelmed me).
-
Adding
implementation ('us.ihmc:ros2-msg-to-pubsub-generator:0.22.2'){ exclude group: 'org.apache.logging.log4j' exclude group: 'org.python' exclude group: 'com.google.code.findbugs' } // generator for .msg -> .javadidn't resolve the issue either.
I'm totally new to Android development, so please forgive me, if this issue is trivial. Maybe some additional steps or assumptions should be added to README?
My environment info:
- Device:
- Android 13.0
- API: 33
- Android Studio: 2022.1.1 Patch1
- Gradle 7.5
- Kotlin: 1.6.21
- Groovy: 3.0.10
- Ant: Apache Ant(TM) version 1.10.11 compiled on July 10 2021
- JVM: 11.0.18 (Ubuntu 11.0.18+10-post-Ubuntu-0ubuntu120.04.1)
- OS: Linux 5.4.0-146-generic amd64
Hi there! I just wanted to drop a quick note to say thanks for reporting this. Unfortunately, our team is super busy right now so we can't look at this at the moment, but I'll keep it in mind and try to get back to you.