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

Create a simple project android ros on windows

asked 2013-12-30 14:53:39 -0500

this post is marked as community wiki

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

I followed the how to Android - Tutorials - hydro - Installation - Android Studio Development Environment

However the gradle can not build a project.

Environment Windows 7 Android 0.4.0 Studio Gradle 1.10 Android API 19

After create a project a apply modifications in bluid.gradle in my subproject. This is the content of the file:

I put spaces in url bacese my karma is insufficient to publish links

    buildscript {
    repositories {
        maven {
            url 'h t t p s : / / github.com/rosjava/rosjava_mvn_repo/raw/master'
        }
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.7.+'
     }
}
apply plugin: 'android'

repositories {
    maven {
        url 'h t t p s : / / github.com/rosjava/rosjava_mvn_repo/raw/master'
    }
    mavenCentral()
}

android {
    compileSdkVersion 19
    buildToolsVersion "19.0.0"

    defaultConfig {
        minSdkVersion 10
        targetSdkVersion 10
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
   compile 'com.android.support:appcompat-v7:+'
   compile 'org.ros.android_core:android_gingerbread_mr1:0.1.+'
    //  compile 'org.ros.android_core:android_honeycomb_mr2:0.1.+'
    compile 'org.ros.rosjava_core:rosjava:0.1.+'
}

When a "Rebluid the project"

Warning (33 items) of

Ignoring InnerClasses attribute for an anonymous inner class

And this error:

Execution failed for task ':brain:preDexDebug'.

com.android.ide.common.internal.LoggedErrorException: Failed to run command: C:\Desenvolvimento\android-studio\sdk\build-tools\android-4.4\dx.bat --dex --output C:\Users\Bernardo\SkyDrive\www\arduino\ros\TheLorem-Brain\brain\build\pre-dexed\debug\xml-apis-1.0.b2-99724b73c87f7d301ef14642ea9d40f15a7c68ba.jar C:\Users\Bernardo.gradle\caches\modules-2\files-2.1\xml-apis\xml-apis\1.0.b2\3136ca936f64c9d68529f048c2618bd356bf85c9\xml-apis-1.0.b2.jar Error Code: 1 Output: trouble processing "javax/xml/parsers/DocumentBuilder.class": Ill-advised or mistaken usage of a core class (java.* or javax.*) when not building a core library. This is often due to inadvertently including a core library file in your application's project, when using an IDE (such as Eclipse). If you are sure you're not intentionally defining a core class, then this is the most likely explanation of what's going on. However, you might actually be trying to define a class in a core namespace, the source of which you may have taken, for example, from a non-Android virtual machine project. This will most assuredly not work. At a minimum, it jeopardizes the compatibility of your app with future versions of the platform. It is also often of questionable legality. If you really intend to build a core library -- which is only appropriate as part of creating a full virtual machine distribution, as opposed to compiling an application -- then use the "--core-library" option to suppress this error message. If you go ahead and use "--core-library" but are in fact building an application, then be forewarned that your application will still fail to build or run, at some point. Please be prepared for angry customers who find, for example, that your application ceases to function once they upgrade their operating system. You will be to blame for this problem. If you are legitimately using some code that happens to be in a core package, then the easiest safe alternative you have ...

(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2014-01-12 19:06:25 -0500

Lunbo gravatar image

I posted a similar question here http://answers.ros.org/question/114996/error-while-run-all-tests-in-a-simple-android-ros-project-in-ubuntu/

The configuration are basically the same except I am using Ubuntu.

I solved my problem by using

compile('org.ros.android_core:android_honeycomb_mr2:0.1.+'){
        exclude group: 'junit'
        exclude group: 'xml-apis'
    }

instead of

compile 'org.ros.android_core:android_honeycomb_mr2:0.1.+'

in your case, try

compile('org.ros.android_core:android_gingerbread_mr1:0.1.+'){
        exclude group: 'junit'
        exclude group: 'xml-apis'
    }
compile('org.ros.android_core:android_honeycomb_mr2:0.1.+'){
        exclude group: 'junit'
        exclude group: 'xml-apis'
    }

hope it works for you.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2013-12-30 14:53:39 -0500

Seen: 2,869 times

Last updated: Jan 12 '14