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

Which version of Android studio works with rosjava?

asked 2014-06-21 13:28:12 -0600

grzebyk gravatar image

Hi

Which version of Android Studio should I download to develop apps with it?

I was successfully using Android Studio preview v. 0.4.2 with rosjava for quite a long time on my mac. I was able to develop android apps on osx without even thinking of installing ROS. That was amazing. Unfortunately recently my setup stopped working - IDE was unable to localize some files. So I updated Andriod studio to the newest dev build version - 0.4.6 and, as I had done with the 0.4.2, I followed this tutorial to set up ROS artifacts. No luck here. In the error output IDE said that I was trying to make impossible stuff that ends with pain suffering and lamentation (literally).

Newer versions (0.5.2, 0.6.0, 0.6.1) produced error saying that module 'org.ros.android_core:android_gingerbread_mr1:0.1.+' contains the same precompile algorithms as the standard library.

Of course currently I'm unable to compile my previously working projects. I have my apps on one device (everything's working perfectly) but I cannot even upload them to the other.

I'm sorry, I didn't provide copies of the IDE output but all day long I'm installing, configuring and trying different ways to make android studio work with row once again. Please let me know if you need the actual error output. I will install IDE once again and provide you with it.

Thank you for your help!

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2014-06-22 01:22:34 -0600

Daniel Stonier gravatar image

updated 2014-06-22 06:55:28 -0600

I just saw the wiki documentation for that is using the ivy style for open ranged dependencies. If you're using the maven repo directly, you need the maven style format (refer to this issue thread). That is,

dependencies {
    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.+'
}

should be

dependencies {
    compile 'org.ros.android_core:android_gingerbread_mr1:[0.1,0.2)'
    compile 'org.ros.android_core:android_honeycomb_mr2:[0.1,0.2)'
    compile 'org.ros.rosjava_core:rosjava:[0.1,0.2)'
}

I updated the wiki to reflect this. Try that and let me know how it goes.

Also note that in general, I try to keep the hydro release branch working and up to date the with the latest version of Android Studio (as of this moment, 0.6.1). The upgrades tend to always require newer versions of gradle, the android gradle plugin and the sdk build tools so when there is a studio update, we update the rosjava_bootstrap and rosjava_build_tools helpers to facilitate this. If you catch an upgrade before we do, send us a pull request (see the RosJava FAQ and Android FAQ for information on how to do so).

If you do want to keep building on old versions of android studio, you can always lock down the appropriate version variables in your build.gradle but we don't have the man-hours to support this officially in the releases.

edit flag offensive delete link more

Comments

Thank you for your answer but it still doesn't work. Creating new project and adding ROS artifacts produce this error: Error:(7, 9) Attribute application@icon value=(@drawable/ic_launcher) from AndroidManifest.xml:7:9 Error:(7, 9) Execution failed for task ':app:processDebugManifest'. > Manifest merger failed : Attribute application@icon value=(@drawable/ic_launcher) from AndroidManifest.xml:7:9 is also present at org.ros.android_core:android_gingerbread_mr1:0.1.2:15:9 value=(@drawable/icon) Suggestion: add 'tools:replace="icon"' to <application> element at AndroidManifest.xml:5:5 to override

grzebyk gravatar image grzebyk  ( 2014-06-22 06:21:40 -0600 )edit

And adding 'tools:replace="icon"' produce error: trouble processing "javax/xml/parsers/DocumentBuilder.class"

grzebyk gravatar image grzebyk  ( 2014-06-22 06:29:31 -0600 )edit

This is not a rosjava issue, but relevant to the last sdk build tools update (19.1) re manifest merging. https://github.com/rosjava/android_extras/commit/7cd5c7482eba75f0040c9acf9f3a55df1bee29bc might be what you are looking for.

Daniel Stonier gravatar image Daniel Stonier  ( 2014-06-22 07:13:44 -0600 )edit

Don't forget to include the `xmlns:tools="http://schemas.android.com/tools"` part.

Daniel Stonier gravatar image Daniel Stonier  ( 2014-06-22 07:14:01 -0600 )edit

The commit you sent me states about overriding icon and label. However when I make those changes in the manifest file I get the following error (taken from the gradle console and looks like 19.1 build tools issue): * What went wrong: Execution failed for task ':app:preDexDebug'. > com.android.ide.common.internal.LoggedErrorException: Failed to run command: /Applications/Android Studio.app/sdk/build-tools/19.1.0/dx --dex --output [path-to-project]/Beginning/app/build/intermediates/pre-dexed/debug/xml-apis-1.0.b2-0ea40d0485d64348d7f5141ff959dba21cff78ef.jar ~/.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

grzebyk gravatar image grzebyk  ( 2014-06-22 07:47:14 -0600 )edit
1

Just managed to reproduce this. Looks like it's having problems dealing with the namespaces. Curious why I haven't seen this before also. Workaround may be in http://answers.ros.org/question/114996/error-while-run-all-tests-in-a-simple-android-ros-project-in-ubuntu/.

Daniel Stonier gravatar image Daniel Stonier  ( 2014-06-22 09:32:43 -0600 )edit

HELL YEAH! That worked! I had to add those excludes from the link. Additionally, due to file duplication, I had to add these lines to build.gradle file android { packagingOptions { exclude 'META-INF/LICENSE.txt' exclude 'META-INF/NOTICE.txt' } } Daniel, thank you very much for your help!

grzebyk gravatar image grzebyk  ( 2014-06-22 10:57:23 -0600 )edit
0

answered 2014-06-21 14:19:51 -0600

updated 2014-06-21 14:20:24 -0600

I'm using 0.5.2 which works well. I followed the install instruction: wiki.ros.org/android/Android%20Studio/Download

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2014-06-21 13:28:12 -0600

Seen: 2,124 times

Last updated: Jun 22 '14