ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

creating my first android app : DefaultNodeFactory symbol not found. [closed]

asked 2012-02-12 16:06:18 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

Hi, I followed the steps in http://ros.org/wiki/ApplicationsPlatform/Clients/Android and installed the android developer tools as explained in here. I Also followed step 4 in creating your own android app, but after hitting rosmake --threads=1 i get the following error on 62nd package make which is my project package that DefaultNodeFactory is not being find. I have copied the error part of the make down below. Also if I do rosmake on any of the tutorial packages they get to compile fine but when I used the steps explained on the website i keep getting this error, so if someone could help me I would really appreciate it.

[rosmake-1] Starting >>> android_test1 [ make ]
[ rosmake ] Last 40 linesdroid_test1: 6... [ 1 Active 62/63 Complete ] {------------------------------------------------------------------------------- [echo] Handling Resources... [aapt] No changed resources. R.java and Manifest.java untouched.

-pre-compile:

-compile: [javac] /home/vahid/ROS_DIR/rosjava_core/rosjava_bootstrap/android.xml:607: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds [javac] Compiling 52 source files to /home/vahid/ROS_DIR/appmanandroid/library/bin/classes [javac] RosActivity.java:48: cannot find symbol [javac] symbol : class DefaultNodeFactory [javac] location: package org.ros.internal.node [javac] import org.ros.internal.node.DefaultNodeFactory; [javac] ^ [javac] SendGoalDisplay.java:59: cannot find symbol [javac] symbol : class DefaultNodeFactory [javac] location: package org.ros.internal.node [javac] import org.ros.internal.node.DefaultNodeFactory; [javac] ^ [javac] RosActivity.java:570: cannot find symbol [javac] symbol: class DefaultNodeFactory [javac] node = new DefaultNodeFactory(nodeMainExecutor.getScheduledExecutorService()).newNode(config); [javac] ^ [javac] SendGoalDisplay.java:206: cannot find symbol [javac] symbol : class DefaultNodeFactory [javac] location: class ros.android.views.SendGoalDisplay [javac] Node newNode = new DefaultNodeFactory().newNode(nc); [javac] ^ [javac] Note: Some input files use unchecked or unsafe operations. [javac] Note: Recompile with -Xlint:unchecked for details. [javac] 4 errors

BUILD FAILED /home/vahid/ROS_DIR/appmanandroid/build_app.xml:116: The following error occurred while executing this line: /home/vahid/android-sdk-linux_x86/tools/ant/build.xml:485: The following error occurred while executing this line: /home/vahid/ROS_DIR/rosjava_core/rosjava_bootstrap/android.xml:587: The following error occurred while executing this line: /home/vahid/ROS_DIR/rosjava_core/rosjava_bootstrap/android.xml:607: Compile failed; see the compiler error output for details.

Total time: 5 seconds Executing command: ['ant'] -------------------------------------------------------------------------------} [ rosmake ] Output from build of package android_test1 written to: [ rosmake ] /home/vahid/.ros/rosmake/rosmake_output-20120212-194658/android_test1/build_output.log [rosmake-1] Finished <<< android_test1 [FAIL] [ 61.48 seconds ]
[ rosmake ] Halting due to failure in package android_test1. [ rosmake ] Waiting for other threads to complete. [ rosmake ] Results:
[ rosmake ] Built 63 packages with 1 failures.
[ rosmake ] Summary output to directory
[ rosmake ] /home/vahid/.ros/rosmake/rosmake_output-20120212-194658

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by kwc
close date 2012-02-29 07:41:06

9 Answers

Sort by ยป oldest newest most voted
1

answered 2012-02-12 18:18:13 -0600

Alexandr Buyval gravatar image

Maybe you use old version rosjava. I don't see class DefaultNodeFactory in my project. Try compare source from your project with source from my project.

/*
 * Copyright (C) 2011 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package myandroid.test_and;

import ros.android.activity.RosAppActivity;
import android.os.Bundle;
import org.ros.node.Node;
import android.util.Log;
import android.widget.Toast;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;

//TODO: search for all instances of TODO

/**
 * @author damonkohler@google.com (Damon Kohler)
 * @author pratkanis@willowgarage.com (Tony Pratkanis)
 */
public class AndroidTest extends RosAppActivity {
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    setDefaultAppName("AndroidTest");
    setDashboardResource(R.id.top_bar);
    setMainWindowResource(R.layout.main);
    super.onCreate(savedInstanceState);

    //TODO: add code
    //Called on creation. ROS hasn't started yet, so don't start
    //anything that depends on ROS. Instead, look up things like
    //resources. Initialize your layout here.
  }

  /** Called when the node is created */
  @Override
  protected void onNodeCreate(Node node) {
    super.onNodeCreate(node);
    //TODO: Put your initialization code here
  }

  /** Called when the node is destroyed */
  @Override
  protected void onNodeDestroy(Node node) {
    super.onNodeDestroy(node);
    //TODO: Put your shutdown code here for things the reference the node
  }

  /** Creates the menu for the options */
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.AndroidTest_menu, menu);
    return true;
  }

  /** Run when the menu is clicked. */
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case R.id.kill: //Shutdown if the user clicks kill
      android.os.Process.killProcess(android.os.Process.myPid());
      return true;
    //TODO: add cases for any additional menu items here.
    default:
      return super.onOptionsItemSelected(item);
    }
  }
}
edit flag offensive delete link more

Comments

thanks for the response, it actually was the same. since i can not leave a lot of comments here i explained it down below. thanks.

vahid gravatar image vahid  ( 2012-02-20 20:04:47 -0600 )edit

Hi I wanted to know if i could please get my question answered down below.

vahid gravatar image vahid  ( 2012-02-25 06:48:57 -0600 )edit
1

answered 2012-02-17 10:17:50 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

This could be caused by having an older version of Rosjava. With the latest version of Rosjava, DefaultNodeFactory can no longer be called with no arguments. RosActivity.java in the appmanandroid library was updated to reflect that. The line where you're getting the error is one that changed.

I would try updating your version of rosjava. Try:

hg pull
hg update

in rosjava_core. If there are any more difficulties in the process for building Android apps let me know. I'm trying to make the documentation as clear as possible.

edit flag offensive delete link more

Comments

Hi , since i can not explain the whole thing in the comment box here i explained it down below.

vahid gravatar image vahid  ( 2012-02-20 20:05:31 -0600 )edit

Hi, I wanted to know if I could please get my question answered down below.

vahid gravatar image vahid  ( 2012-02-25 06:48:32 -0600 )edit

Please edit your original question or post new questions if the original question is answered. I am closing this post because this is now unanswerable given the multiple threads here.

kwc gravatar image kwc  ( 2012-02-29 07:40:14 -0600 )edit
0

answered 2012-02-20 20:02:18 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

Hi thanks for the response. When I updated the my rosjava it seems it updated 5 packages and I started creating a new package again and the problem still exist. I still get the same error on the top. @Alexandr: I checked my source code against yours and it seems that everything is the same but I do not know why it gives me this errors. One more thing that I keep having a problem with is that when I walk through one of the tutorial after creating the package and typing rosrun appmanandroid android_create --create ... I run rosinstall ROS_DIR . in which I keep getting errors each time that ros stack is not found. it asks me to either types it in manually in .rosinstall or install the whole ros stack from website using .rosinstall. I do not know to be honest if this would have any impact on this or not. Can you please tell me the step by step to setup rosjava please. I have been working to try to fix this thing right now for weeks, but no success. thanks, Vahid.

edit flag offensive delete link more

Comments

1) sudo apt-get install ant ant-contrib maven-ant-helper 2) Install Eclipse and ADT 3) sudo apt-get install python-setuptools 4) sudo easy_install -U rosinstall 5)rosinstall /opt/ros/electric/ros/android https://kforge.ros.org/appmanandroid/hg/raw-file/tip/appman.rosinstall

Alexandr Buyval gravatar image Alexandr Buyval  ( 2012-02-20 21:46:31 -0600 )edit

1) sudo apt-get install ant ant-contrib maven-ant-helper

Alexandr Buyval gravatar image Alexandr Buyval  ( 2012-02-20 21:46:35 -0600 )edit

I pushed a change to the appmanandroid library to fix this issue. I did a setup of a whole environment last night and got similar feedback from someone else. We were able to fix this issue on our installations after I updated appmanandroid. So sorry for the issues. Hope it will work now.

selliott gravatar image selliott  ( 2012-02-21 08:04:04 -0600 )edit
0

answered 2012-02-22 18:08:46 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

Now I am getting another error regarding Target "nodeps" does not exist in the project "android_gingerbread how should I fix this thanks. Vahid.

edit flag offensive delete link more
0

answered 2012-02-23 06:40:01 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

By applying the patch mentioned on the website it seems I fixed this error, but it seems that another error occurred which is in regards to {build.Target} not being found or something. I wanted to know how should fix this error now. Thanks, Vahid.

edit flag offensive delete link more

Comments

I don't think I've seen that error before. Do you think you could post more detail? I'll see if I can replicate it.

selliott gravatar image selliott  ( 2012-02-23 09:58:19 -0600 )edit

Is it possible that you're missing components of the Android SDK? Try running the 'android' command with no arguments. The AVD Manager should come up. Make sure you have all the API levels selected. Remember to check the box for obsolete packages so you can install API 9 if it's missing.

selliott gravatar image selliott  ( 2012-02-23 10:15:03 -0600 )edit

Maybe double check your environment variables too.

selliott gravatar image selliott  ( 2012-02-23 10:16:32 -0600 )edit

I ran the android command and once the window popped up I was able to see almost all of the SDKs to be installed, even those that were obsolete like API9.

vahid gravatar image vahid  ( 2012-02-23 10:22:21 -0600 )edit

What should I check as far as environment variables?

vahid gravatar image vahid  ( 2012-02-23 10:22:44 -0600 )edit

export PATH=$PATH:/home/vahid/android-sdk-linux_x86/tools:/home/vahid/android-sdk-linux_x86/platform_tools source /opt/ros/electric/setup.bash source /opt/ros/electric/setup.bash source /home/vahid/ROS_DIR/setup.bash

vahid gravatar image vahid  ( 2012-02-23 10:25:02 -0600 )edit

export PATH=$PATH:/home/vahid/android-sdk-linux_x86/tools:/home/vahid/android-sdk-linux_x86/platform_tools source /opt/ros/electric/setup.bash source /opt/ros/electric/setup.bash source /home/vahid/ROS_DIR/setup.bash

vahid gravatar image vahid  ( 2012-02-23 10:25:03 -0600 )edit

this is what i put in my .bashrc

vahid gravatar image vahid  ( 2012-02-23 10:25:25 -0600 )edit
0

answered 2012-02-23 10:48:48 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

-compile: [javac] /home/vahid/ROS_DIR/rosjava_core/rosjava_bootstrap/android.xml:607: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds [echo] Creating library output jar file... Trying to override old definition of task dex-helper

nodeps:

-setup: [echo] Gathering info for AppManAndroid... [setup] Android SDK Tools Revision 16 [setup] Project Target: Android 2.3.1 [setup] API level: 9 [setup] Project Type: Android Library [setup] [setup] ------------------ [setup] Resolving library dependencies: [setup] /home/vahid/ROS_DIR/appmanandroid/library: ../../rosjava_android/android_gingerbread/. => /home/vahid/ROS_DIR/rosjava_android/android_gingerbread [setup] ------------------ [setup] Ordered libraries: [setup] /home/vahid/ROS_DIR/rosjava_android/android_gingerbread [setup] ------------------ [setup]

-build-setup: [echo] Building Libraries

BUILD FAILED /home/vahid/ROS_DIR/appmanandroid/build_app.xml:116: The following error occurred while executing this line: /home/vahid/android-sdk-linux_x86/tools/ant/build.xml:485: The following error occurred while executing this line: /home/vahid/ROS_DIR/rosjava_core/rosjava_bootstrap/android.xml:472: The following error occurred while executing this line: Target "${build.target}" does not exist in the project "android_gingerbread".

Total time: 1 second Executing command: ['ant'] -------------------------------------------------------------------------------} [ rosmake ] Output from build of package android_app_chooser written to: [ rosmake ] /home/vahid/.ros/rosmake/rosmake_output-20120223-144231/android_app_chooser/build_output.log [rosmake-0] Finished <<< android_app_chooser [FAIL] [ 52.48 seconds ]
[ rosmake ] Halting due to failure in package android_app_chooser. [ rosmake ] Waiting for other threads to complete. [ rosmake ] Results:
[ rosmake ] Built 63 packages with 1 failures.
[ rosmake ] Summary output to directory
[ rosmake ] /home/vahid/.ros/rosmake/rosmake_output-20120223-144231

edit flag offensive delete link more
0

answered 2012-02-23 05:05:20 -0600

brianpen gravatar image

I ran into the same issue awhile ago while trying to build the existing android apps. The API (rosjava) has been refactored, but the apps haven't been updated to reflect it yet. I just pulled a pre-refactor version of rosjava, but it sounds like someone else in this thread has committed a more permanent fix.

edit flag offensive delete link more
0

answered 2012-02-23 10:27:02 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

!/usr/bin/env sh

THIS IS A FILE AUTO-GENERATED BY rosinstall

IT IS UNLIKELY YOU WANT TO EDIT THIS FILE BY HAND

IF YOU WANT TO CHANGE THE ROS ENVIRONMENT VARIABLES

USE THE rosinstall TOOL INSTEAD.

see: http://www.ros.org/wiki/rosinstall

export ROS_ROOT=/opt/ros/electric/ros export PATH=$ROS_ROOT/bin:$PATH export PYTHONPATH=$ROS_ROOT/core/roslib/src:$PYTHONPATH export PATH=$PATH:/home/vahid/android-sdk-linux_x86/tools:/home/vahid/android-sdk-linux_x86/platform_tools if [ ! "$ROS_MASTER_URI" ] ; then export ROS_MASTER_URI=http://localhost:11311 ; fi export ROS_PACKAGE_PATH=/home/vahid/ros_workspace:/opt/ros/electric/stacks:/home/vahid/ROS_DIR/turtlebot:/home/vahid/ROS_DIR/appmanwx:/home/vahid/ROS_DIR/android_voice_recognition:/home/vahid/ROS_DIR/rosjava_android:/home/vahid/ROS_DIR/android_pr2_props:/home/vahid/ROS_DIR/android_pan_tilt:/home/vahid/ROS_DIR/android_map_nav:/home/vahid/ROS_DIR/android_make_a_map:/home/vahid/ROS_DIR/android_map_manager:/home/vahid/ROS_DIR/android_app_chooser:/home/vahid/ROS_DIR/android_teleop:/home/vahid/ROS_DIR/appmanandroid:/home/vahid/ROS_DIR/rosjava_core:/opt/ros/electric/stacks export ROS_WORKSPACE=/home/vahid/ROS_DIR

edit flag offensive delete link more

Comments

As far as I can see your environment variables look fine. What is the exact error you're getting? Also, you mentioned that you saw all the SDK components. Did they say "Installed" next to them?

selliott gravatar image selliott  ( 2012-02-23 10:32:16 -0600 )edit

yes it said install next to the SDKs only the things like examples and so on were on installed.

vahid gravatar image vahid  ( 2012-02-23 10:45:15 -0600 )edit

I just copied the part regarding the build Failed in the answer you question part down below.

vahid gravatar image vahid  ( 2012-02-23 10:46:26 -0600 )edit
0

answered 2012-02-23 10:45:41 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

BUILD FAILED /home/vahid/ROS_DIR/appmanandroid/build_app.xml:116: The following error occurred while executing this line: /home/vahid/android-sdk-linux_x86/tools/ant/build.xml:485: The following error occurred while executing this line: /home/vahid/ROS_DIR/rosjava_core/rosjava_bootstrap/android.xml:472: The following error occurred while executing this line: Target "${build.target}" does not exist in the project "android_gingerbread".

Total time: 1 second Executing command: ['ant'] -------------------------------------------------------------------------------} [ rosmake ] Output from build of package android_app_chooser written to: [ rosmake ] /home/vahid/.ros/rosmake/rosmake_output-20120223-144231/android_app_chooser/build_output.log [rosmake-0] Finished <<< android_app_chooser [FAIL] [ 52.48 seconds ]
[ rosmake ] Halting due to failure in package android_app_chooser. [ rosmake ] Waiting for other threads to complete. [ rosmake ] Results:
[ rosmake ] Built 63 packages with 1 failures.
[ rosmake ] Summary output to directory
[ rosmake ] /home/vahid/.ros/rosmake/rosmake_output-20120223-144231

edit flag offensive delete link more

Comments

actually I added the whole thing down below after it fails in package 62/63.

vahid gravatar image vahid  ( 2012-02-23 10:49:37 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2012-02-12 16:06:18 -0600

Seen: 2,702 times

Last updated: Feb 23 '12