Rosjava InetAddress failure [closed]

asked 2011-11-22 01:43:05 -0500

SgtSquatlow gravatar image

Hi, I have been attempting to use rosjava with android 3.1 with no success. I was following some of the examples, but I get an unexpected failure in the InetAddress. The message is: "Could not find method com.google.common.net.InetAddresses.isInetAddress, reference from method org.ros.address.InetAddressFactory.newFromHostString". My code is very simple. Here it is:

package org.blh.android;
import android.app.Activity;

import java.net.InetAddress;
import java.net.URI;
import java.net.URISyntaxException;
import org.ros.address.InetAddressFactory;
import org.ros.internal.node.DefaultNodeFactory;
import org.ros.node.Node;
import org.ros.node.NodeConfiguration;
import org.ros.node.DefaultNodeRunner;
import android.os.Bundle;
import android.widget.Toast;

public class TestRosActivity extends Activity {
    String ip = "10.0.0.8";
    String masterUri = "http://" + ip + ":11311/";
    URI uri = null;
    String host = null; 
    NodeConfiguration nodeconfiguration = null;

    String defaultNodeName = "my_node";
    DefaultNodeFactory factory = null;
    Node node = null;

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        String dump = "";

        try
        {
            uri = new URI(masterUri);
            InetAddress inet = InetAddressFactory.newNonLoopback();
            dump += "1,";
            if (inet != null)
            {
                host = inet.getHostName();
                dump += "2,";
                nodeconfiguration = NodeConfiguration.newPublic(host, uri);
                dump += "3,";
                factory = new DefaultNodeFactory();
                dump += "4,";
                node = factory.newNode(nodeconfiguration);
                dump += "5,";
            }
        }
        catch (Exception e)
        {
            Toast t = Toast.makeText(getApplicationContext(), "Exception: " + e.getMessage() + ". " + dump, Toast.LENGTH_LONG);
            t.show();
        }
    }
}

I am pretty new to ros, so hopefully it isn't a stupid mistake on my part. I didn't forget to add the internet permission. I have tried this on the emulator (2.3.3) and on my tablet (3.1).

Thanks for your help.

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by damonkohler
close date 2012-01-27 03:58:32