Running Shapes on Android

Hi guys,

I'm trying to run the Shapes demo for an Android 2.3.3 phone. I get the following error:

02-27 14:45:22.656: E/AndroidRuntime(823): Caused by: java.lang.UnsatisfiedLinkError: Cannot load library: get_lib_extents[787]: 75 - No loadable segments found in /data/data/com.toc.shapes/lib/libdds_java.so.

I read the README.txt file. I've installed the coredx_dds.lic file ensuring a single line for each LICENSE PRODUCT. Every builds ok and installs fine. I just can't seem to get the program running once it is on the phone.

I've been able to run and build the Linux version of the demo. I've also been able to install and build other apps for the Android.

Android information:

Model number: Full Android on Crespo
Android version: 2.3.3

No SIM card on phone.

Thanks for any info!

-j

Comments

Re: Running Shapes on Android

Hmmm. It sounds like there might be a problem with the 'libdds_java.so' file. This file provides the native library (binary code) for CoreDX DDS middleware.

First, this file should probably be located in lib/armeabi/libdds_java.so in your applications .apk file.
You can verify this if you run 'unzip -l bin/Shapes-debug.apk'. For example:

> unzip -l bin/Shapes-debug.apk
Archive: bin/Shapes-debug.apk
Length Date Time Name
--------- ---------- ----- ----
2577 2012-02-27 14:19 res/drawable/btn_circle.png
5697 2012-02-27 14:19 res/drawable/btn_circle_focus.png
5671 2012-02-27 14:19 res/drawable/btn_circle_selected.png
2717 2012-02-27 14:19 res/drawable/btn_square_focus.png
2766 2012-02-27 14:19 res/drawable/btn_square_selected.png
2028 2012-02-27 14:19 res/drawable/btn_triangle.png
4275 2012-02-27 14:19 res/drawable/btn_triangle_focus.png
4234 2012-02-27 14:19 res/drawable/btn_triangle_selected.png
2295 2012-02-27 14:19 res/drawable/color_black.png
3953 2012-02-27 14:19 res/drawable/color_black_focus.png
2463 2012-02-27 14:19 res/drawable/color_black_selected.png
2471 2012-02-27 14:19 res/drawable/color_blue.png
3189 2012-02-27 14:19 res/drawable/color_blue_focus.png
2694 2012-02-27 14:19 res/drawable/color_blue_selected.png
2835 2012-02-27 14:19 res/drawable/color_cyan.png
3154 2012-02-27 14:19 res/drawable/color_cyan_focus.png
3055 2012-02-27 14:19 res/drawable/color_cyan_selected.png
2466 2012-02-27 14:19 res/drawable/color_green.png
2891 2012-02-27 14:19 res/drawable/color_green_focus.png
2686 2012-02-27 14:19 res/drawable/color_green_selected.png
2821 2012-02-27 14:19 res/drawable/color_magenta.png
3086 2012-02-27 14:19 res/drawable/color_magenta_focus.png
3059 2012-02-27 14:19 res/drawable/color_magenta_selected.png
3318 2012-02-27 14:19 res/drawable/color_orange.png
2808 2012-02-27 14:19 res/drawable/color_orange_focus.png
3443 2012-02-27 14:19 res/drawable/color_orange_selected.png
2990 2012-02-27 14:19 res/drawable/color_red.png
2492 2012-02-27 14:19 res/drawable/color_red_focus.png
2696 2012-02-27 14:19 res/drawable/color_red_selected.png
2839 2012-02-27 14:19 res/drawable/color_yellow.png
2765 2012-02-27 14:19 res/drawable/color_yellow_focus.png
3090 2012-02-27 14:19 res/drawable/color_yellow_selected.png
6840 2012-02-27 14:19 res/drawable/coredx_logo_240x270.png
860 2012-02-27 14:19 res/drawable/rb_black.xml
860 2012-02-27 14:19 res/drawable/rb_blue.xml
860 2012-02-27 14:19 res/drawable/rb_circle.xml
860 2012-02-27 14:19 res/drawable/rb_cyan.xml
860 2012-02-27 14:19 res/drawable/rb_green.xml
860 2012-02-27 14:19 res/drawable/rb_magenta.xml
860 2012-02-27 14:19 res/drawable/rb_orange.xml
860 2012-02-27 14:19 res/drawable/rb_red.xml
860 2012-02-27 14:19 res/drawable/rb_square.xml
860 2012-02-27 14:19 res/drawable/rb_triangle.xml
860 2012-02-27 14:19 res/drawable/rb_yellow.xml
5412 2012-02-27 14:19 res/layout/addwriter.xml
1448 2012-02-27 14:19 res/layout/main.xml
1008 2012-02-27 14:19 res/layout/writerlist.xml
600 2012-02-27 14:19 res/menu/menu.xml
1896 2012-02-27 14:19 AndroidManifest.xml
10428 2012-02-27 14:19 resources.arsc
3573 2012-02-27 14:19 res/drawable-hdpi/icon.png
1554 2012-02-27 14:19 res/drawable-ldpi/icon.png
2462 2012-02-27 14:19 res/drawable-mdpi/icon.png
1448 2012-02-27 14:19 res/layout-land/main.xml
5412 2012-02-27 14:19 res/layout-port/addwriter.xml
1448 2012-02-27 14:19 res/layout-port/main.xml
1008 2012-02-27 14:19 res/layout-port/writerlist.xml
374596 2012-02-27 14:19 classes.dex
569156 2012-02-27 13:44 lib/armeabi/libdds_java.so
4974 2012-02-27 14:19 META-INF/MANIFEST.MF
5027 2012-02-27 14:19 META-INF/CERT.SF
776 2012-02-27 14:19 META-INF/CERT.RSA
--------- -------
1109059 63 files

Next, this file should be a 32bit ELF ARM LSB format shared library. You can check this with the unix 'file' command. The result should look something like this:

> file libdds_java.so
libdds_java.so: ELF 32-bit LSB shared object, ARM, version 1 (SYSV), dynamically linked, stripped

It is possible that you have grabbed an incorrect version of libdds_java.so (perhaps one targeted for x86 Linux instead of ARM Android).

I hope this helps - let me know if you are still stuck!

--clark

Re: Running Shapes on Android

Thanks for the info! I was able to load the app on my Android. The issue was that I had 2 coredx installations, one for the 64-bit linux OS I'm on and the other is for the Android. I think the README.txt file that comes with the Android download should revise step 3 to state:

3) Ensure that COREDX_TOP, COREDX_HOST, and COREDX_TARGET
envirionment variables are set to the Android CoreDX installation.

This way the scripts under the tocshapes example will work out of the box.

Once I got the app up and running the following screenshot was show on my Android (imgur link):

http://i.imgur.com/6piO4.png

But all is shows is the CoreDX shapes logo and a "Quit" button. I don't see anything for Menu.

Using the DDMS tool, I don't see any issue, everything looks "normal" with Topics, Readers, and Writers being created without any error messages.

I imported it into Eclipse and ran the debugger.

When it gets to the following in Shapes.java:
dpf = DomainParticipantFactory.get_instance(); // get DomainParticipantFactory

Once I have the app up and running
02-28 10:59:01.484: D/dalvikvm(17467): Trying to load lib /data/data/com.toc.shapes/lib/libdds_java.so 0x405165a0
02-28 10:59:01.495: D/dalvikvm(17467): Added shared lib /data/data/com.toc.shapes/lib/libdds_java.so 0x405165a0
02-28 10:59:01.495: D/dalvikvm(17467): No JNI_OnLoad found in /data/data/com.toc.shapes/lib/libdds_java.so 0x405165a0, skipping init

The logs then show that it does create the publishers and subscribers after this so this could just be a debugging issue.

Is there anything that I'm not setting up properly? Should I be seeing menu items to create/start publishers/subscribers? I have the Linux version of the Shapes demo to work and was able to create publishers and subscribers. Running the Android app, it doesn't appear to connect to the Linux program.

Re: Running Shapes on Android

Great news! It looks like everything is working properly. The messages in the log are normal in my experience when loading a native library.

The button to create a publisher is 'hidden' in the Configure or Options button of the Android device. [Along with a button to create subscribers - which currently is not operational.]

The Android shapes app automatically creates Data Readers on each of the three topics (Square, Circle, Triangle). They are basic readers (best-effort, history depth=1), and there is currently no GUI implemented to adjust the reader's QoS or to create additional readers. [Left as an exercise for the user? ;)]

The user-interface of the Shapes Android App could certainly use some help to make it more robust and user-friendly...

Re: Running Shapes on Android

Thanks, Clark!

I'm sooo close to actually getting it working, but as of yet, it is still not doing anything. I have the example running on my Android. I also have an example running on my Linux x86_64 machine. I can ping the Android phone from my Linux box with the following response times:

jtorres@ubuntu:~/lib/coredx/coredx-3.4.0-Evaluation/examples/hello_java$ ping xxx.xxx.xxx.254
PING xxx.xxx.xxx.254 (xxx.xxx.xxx.254) 56(84) bytes of data.
64 bytes from xxx.xxx.xxx.254: icmp_req=1 ttl=63 time=24.0 ms
64 bytes from xxx.xxx.xxx.254: icmp_req=2 ttl=63 time=95.1 ms
64 bytes from xxx.xxx.xxx.254: icmp_req=3 ttl=63 time=33.5 ms
64 bytes from xxx.xxx.xxx.254: icmp_req=4 ttl=63 time=4.15 ms
64 bytes from xxx.xxx.xxx.254: icmp_req=5 ttl=63 time=21.8 ms
64 bytes from xxx.xxx.xxx.254: icmp_req=6 ttl=63 time=60.8 ms

I fire up the Shapes demo for Java on my Linux box and start up a square publisher. I use the default settings:

Topic: Square
Color: Black
Size: 20
Velocity: 10
Direction: 45
Durability.kind: VOLATILE
Deadline.period: -1
Latency.budget: 0
Reliability.kind: BEST_EFFORT
History.kind: KEEP_LAST
History.depth: 1
Ownership.kind: SHARED
Ownership.Strength: 0
Partition.name[0]:

I can see the square moving in the Linux demo. I was hoping to see a similar shape on the Android, but I don't see anything. I'm assuming this is a multicast demo and does not require a dds peers list of some sort.

Thanks!

-j

Re: Running Shapes on Android

Hmmm... Yes, by default the shapes demo will use Multicast for discovery (and data). Some android platforms have limited or no support for receiving multicast; however, CoreDX DDS will account for this, and discovery should still work. We've successfully tested on Droid Incredible 2 devices and Kindle Fire tablets.

I believe that the Java Shapes demo will print out information about 'Publication matched' events to the shell, and also show it in the GUI under the 'Matched' column -- are you seeing a zero here? If so, then it sounds like discovery is not completing.

If possible, e-mail me (ctucker @ twin oaks computing.com) a network capture of the RTPS traffic on the Linux host. Start the capture before running either Shapes app. Start each app, create a publisher on Linux, run for 30 seconds, and then stop both apps, and finally, stop the capture. To limit the capture to RTPS packets, you can use a Capture Filter like this (assuming you are using wireshark): "udp[8:4] == 0x52545053 or (ip[6:2] & 0x1FFF != 0)".

If this isn't possible, then we can turn on some debugging messages in CoreDX DDS and track it from that angle...

RE: Running Shapes on Android

Just wanted to follow up on the post and close the issue. The issue seemed to be that the Android application was not getting the proper handshake with the application on my Linux machine(s) through multicast. The phone and the linux app are on different subnets. By using unicast, since both nodes are known, communication was established and messages are now being passed between each app.