Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Android Studio 1.1 with blank Android project woes

I am trying to use the gradle/artifact method in the tutorials at:

http://wiki.ros.org/android/Tutorials/hydro/Installation%20-%20Android%20Studio%20Development%20Environment

I have a lot of problems trying to build a RosJava 'blank' Android Studio project both on Windows and Ubuntu.

By 'blank' Android Studio project, I did the following: Fresh install of Android Studio (1.1) and SDK (24.1.2) Project Close if one open, or ... 'Start a new Android Studio Project' File > New Project... > Phone and Tablet , API 18 - 4.3 Jelly Bean > Blank Activity > Finish It complains about rendering problems, but once the Gradle build completes it is okay.

Build and run the project, it works. See the 'Hello World' on the blank App.

In the project explorer, open 'Gradle Scripts > build.gradle (Module: app), and add lines so the file 'dependencies' section is replaced with the following 2 sections, repositories and dependencies:

repositories {

maven {

    url 'https://github.com/rosjava/rosjava_mvn_repo/raw/master'

}

mavenCentral()

}

dependencies {

compile fileTree(dir: 'libs', include: ['*.jar'])

compile 'com.android.support:appcompat-v7:22.0.0'

//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)'

}

Click the 'Sync Now' in the yellow band near the top, and wait for the Gradle task to finish

Do Build > ReBuild Project Again the project runs with no problem.

On Windows, I had to remove a line in AndroidManifest.xml:

Uncomment the 'compile ... gingerbread line, in Build.gradle: app click the yellow bar to Sync Now rebuild the project, and see the errors The errors are below:

Executing tasks: [:app:assembleDebug]

Configuration on demand is an incubating feature. :app:preBuild UP-TO-DATE :app:preDebugBuild UP-TO-DATE :app:compileDebugNdk UP-TO-DATE :app:checkDebugManifest :app:preReleaseBuild UP-TO-DATE :app:prepareComAndroidSupportAppcompatV72200Library UP-TO-DATE :app:prepareComAndroidSupportSupportV42200Library UP-TO-DATE :app:prepareOrgRosAndroid_coreAndroid_gingerbread_mr1012Library UP-TO-DATE :app:prepareDebugDependencies :app:compileDebugAidl UP-TO-DATE :app:compileDebugRenderscript UP-TO-DATE :app:generateDebugBuildConfig UP-TO-DATE :app:generateDebugAssets UP-TO-DATE :app:mergeDebugAssets UP-TO-DATE :app:generateDebugResValues UP-TO-DATE :app:generateDebugResources UP-TO-DATE :app:mergeDebugResources UP-TO-DATE :app:processDebugManifest UP-TO-DATE :app:processDebugResources UP-TO-DATE :app:generateDebugSources UP-TO-DATE :app:compileDebugJava UP-TO-DATE :app:preDexDebug AGPBI: {"kind":"SIMPLE","text":"trouble processing \"javax/xml/parsers/DocumentBuilder.class\":","position":{},"original":"trouble processing \"javax/xml/parsers/DocumentBuilder.class\":"} AGPBI: {"kind":"SIMPLE","text":"Ill-advised or mistaken usage of a core class (java.* or javax.)","position":{},"original":"Ill-advised or mistaken usage of a core class (java. or javax.*)"} AGPBI: {"kind":"SIMPLE","text":"when not building a core library.","position":{},"original":"when not building a core library."} AGPBI: {"kind":"SIMPLE","text":"This is often due to inadvertently including a core library file","position":{},"original":"This is often due to inadvertently including a core library file"} AGPBI: {"kind":"SIMPLE","text":"in your application\u0027s project, when using an IDE (such as","position":{},"original":"in your application\u0027s project, when using an IDE (such as"} AGPBI: {"kind":"SIMPLE","text":"Eclipse). If you are sure you\u0027re not intentionally defining a","position":{},"original":"Eclipse). If you are sure you\u0027re not intentionally defining a"} AGPBI: {"kind":"SIMPLE","text":"core class, then this is the most likely explanation of what\u0027s","position":{},"original":"core class, then this is the most likely explanation of what\u0027s"} AGPBI: {"kind":"SIMPLE","text":"going on.","position":{},"original":"going on."} AGPBI: {"kind":"SIMPLE","text":"However, you might actually be trying to define a class in a core","position":{},"original":"However, you might actually be trying to define a class in a core"} AGPBI: {"kind":"SIMPLE","text":"namespace, the source of which you may have taken, for example,","position":{},"original":"namespace, the source of which you may have taken, for example,"} AGPBI: {"kind":"SIMPLE","text":"from a non-Android virtual machine project. This will most","position":{},"original":"from a non-Android virtual machine project. This will most"} AGPBI: {"kind":"SIMPLE","text":"assuredly not work. At a minimum, it jeopardizes the","position":{},"original":"assuredly not work. At a minimum, it jeopardizes the"} AGPBI: {"kind":"SIMPLE","text":"compatibility of your app with future versions of the platform.","position":{},"original":"compatibility of your app with future versions of the platform."} AGPBI: {"kind":"SIMPLE","text":"It is also often of questionable legality.","position":{},"original":"It is also often of questionable legality."} AGPBI: {"kind":"SIMPLE","text":"If you really intend to build a core library -- which is only","position":{},"original":"If you really intend to build a core library -- which is only"} AGPBI: {"kind":"SIMPLE","text":"appropriate as part of creating a full virtual machine","position":{},"original":"appropriate as part of creating a full virtual machine"} AGPBI: {"kind":"SIMPLE","text":"distribution, as opposed to compiling an application -- then use","position":{},"original":"distribution, as opposed to compiling an application -- then use"} AGPBI: {"kind":"SIMPLE","text":"the \"--core-library\" option to suppress this error message.","position":{},"original":"the \"--core-library\" option to suppress this error message."} AGPBI: {"kind":"SIMPLE","text":"If you go ahead and use \"--core-library\" but are in fact","position":{},"original":"If you go ahead and use \"--core-library\" but are in fact"} AGPBI: {"kind":"SIMPLE","text":"building an application, then be forewarned that your application","position":{},"original":"building an application, then be forewarned that your application"} AGPBI: {"kind":"SIMPLE","text":"will still fail to build or run, at some point. Please be","position":{},"original":"will still fail to build or run, at some point. Please be"} AGPBI: {"kind":"SIMPLE","text":"prepared for angry customers who find, for example, that your","position":{},"original":"prepared for angry customers who find, for example, that your"} AGPBI: {"kind":"SIMPLE","text":"application ceases to function once they upgrade their operating","position":{},"original":"application ceases to function once they upgrade their operating"} AGPBI: {"kind":"SIMPLE","text":"system. You will be to blame for this problem.","position":{},"original":"system. You will be to blame for this problem."} AGPBI: {"kind":"SIMPLE","text":"If you are legitimately using some code that happens to be in a","position":{},"original":"If you are legitimately using some code that happens to be in a"} AGPBI: {"kind":"SIMPLE","text":"core package, then the easiest safe alternative you have is to","position":{},"original":"core package, then the easiest safe alternative you have is to"} AGPBI: {"kind":"SIMPLE","text":"repackage that code. That is, move the classes in question into","position":{},"original":"repackage that code. That is, move the classes in question into"} AGPBI: {"kind":"SIMPLE","text":"your own package namespace. This means that they will never be in","position":{},"original":"your own package namespace. This means that they will never be in"} AGPBI: {"kind":"SIMPLE","text":"conflict with core system classes. JarJar is a tool that may help","position":{},"original":"conflict with core system classes. JarJar is a tool that may help"} AGPBI: {"kind":"SIMPLE","text":"you in this endeavor. If you find that you cannot do this, then","position":{},"original":"you in this endeavor. If you find that you cannot do this, then"} AGPBI: {"kind":"SIMPLE","text":"that is an indication that the path you are on will ultimately","position":{},"original":"that is an indication that the path you are on will ultimately"} AGPBI: {"kind":"SIMPLE","text":"lead to pain, suffering, grief, and lamentation.","position":{},"original":"lead to pain, suffering, grief, and lamentation."} AGPBI: {"kind":"SIMPLE","text":"1 error; aborting","position":{},"original":"1 error; aborting"}

FAILED

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':app:preDexDebug'.

    com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_25\bin\java.exe'' finished with non-zero exit value 1

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Android Studio 1.1 with blank Android project woes

I am trying to use the gradle/artifact method in the tutorials at:

http://wiki.ros.org/android/Tutorials/hydro/Installation%20-%20Android%20Studio%20Development%20Environment

I have a lot of problems trying to build a RosJava 'blank' Android Studio project both on Windows and Ubuntu.

By 'blank' Android Studio project, I did the following: following:

  • Fresh install of Android Studio (1.1) and SDK (24.1.2) (24.1.2)
  • Project Close if one open, or ... ...
  • 'Start a new Android Studio Project' Project'
  • File > New Project... > Phone and Tablet , API 18 - 4.3 Jelly Bean > Blank Activity > Finish Finish

It complains about rendering problems, but once the Gradle build completes it is okay.

Build and run the project, it works. See the 'Hello World' on the blank App.

In the project explorer, open 'Gradle Scripts > build.gradle (Module: app), and add lines so the file 'dependencies' section is replaced with the following 2 sections, repositories and dependencies:

repositories {

repositories {
    maven {
      url 'https://github.com/rosjava/rosjava_mvn_repo/raw/master'
  }
  mavenCentral()

}

} dependencies {

{
    compile fileTree(dir: 'libs', include: ['*.jar'])

 compile 'com.android.support:appcompat-v7:22.0.0'

 //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)'
}

}

Click the 'Sync Now' in the yellow band near the top, and wait for the Gradle task to finish

Do Build > ReBuild Project Again the project runs with no problem.

On Windows, I had to remove a line in AndroidManifest.xml: <!--android:icon="@mipmap/ic_launcher"-->

Uncomment the 'compile ... gingerbread line, in Build.gradle: app click the yellow bar to Sync Now rebuild the project, and see the errors The errors are below:

Executing tasks: [:app:assembleDebug]

[:app:assembleDebug] Configuration on demand is an incubating feature. :app:preBuild UP-TO-DATE :app:preDebugBuild UP-TO-DATE :app:compileDebugNdk UP-TO-DATE :app:checkDebugManifest :app:preReleaseBuild UP-TO-DATE :app:prepareComAndroidSupportAppcompatV72200Library UP-TO-DATE :app:prepareComAndroidSupportSupportV42200Library UP-TO-DATE :app:prepareOrgRosAndroid_coreAndroid_gingerbread_mr1012Library UP-TO-DATE :app:prepareDebugDependencies :app:compileDebugAidl UP-TO-DATE :app:compileDebugRenderscript UP-TO-DATE :app:generateDebugBuildConfig UP-TO-DATE :app:generateDebugAssets UP-TO-DATE :app:mergeDebugAssets UP-TO-DATE :app:generateDebugResValues UP-TO-DATE :app:generateDebugResources UP-TO-DATE :app:mergeDebugResources UP-TO-DATE :app:processDebugManifest UP-TO-DATE :app:processDebugResources UP-TO-DATE :app:generateDebugSources UP-TO-DATE :app:compileDebugJava UP-TO-DATE :app:preDexDebug AGPBI: {"kind":"SIMPLE","text":"trouble processing \"javax/xml/parsers/DocumentBuilder.class\":","position":{},"original":"trouble processing \"javax/xml/parsers/DocumentBuilder.class\":"} AGPBI: {"kind":"SIMPLE","text":"Ill-advised or mistaken usage of a core class (java.* or javax.)","position":{},"original":"Ill-advised javax.*)","position":{},"original":"Ill-advised or mistaken usage of a core class (java. (java.* or javax.*)"} AGPBI: {"kind":"SIMPLE","text":"when not building a core library.","position":{},"original":"when not building a core library."} AGPBI: {"kind":"SIMPLE","text":"This is often due to inadvertently including a core library file","position":{},"original":"This is often due to inadvertently including a core library file"} AGPBI: {"kind":"SIMPLE","text":"in your application\u0027s project, when using an IDE (such as","position":{},"original":"in your application\u0027s project, when using an IDE (such as"} AGPBI: {"kind":"SIMPLE","text":"Eclipse). If you are sure you\u0027re not intentionally defining a","position":{},"original":"Eclipse). If you are sure you\u0027re not intentionally defining a"} AGPBI: {"kind":"SIMPLE","text":"core class, then this is the most likely explanation of what\u0027s","position":{},"original":"core class, then this is the most likely explanation of what\u0027s"} AGPBI: {"kind":"SIMPLE","text":"going on.","position":{},"original":"going on."} AGPBI: {"kind":"SIMPLE","text":"However, you might actually be trying to define a class in a core","position":{},"original":"However, you might actually be trying to define a class in a core"} AGPBI: {"kind":"SIMPLE","text":"namespace, the source of which you may have taken, for example,","position":{},"original":"namespace, the source of which you may have taken, for example,"} AGPBI: {"kind":"SIMPLE","text":"from a non-Android virtual machine project. This will most","position":{},"original":"from a non-Android virtual machine project. This will most"} AGPBI: {"kind":"SIMPLE","text":"assuredly not work. At a minimum, it jeopardizes the","position":{},"original":"assuredly not work. At a minimum, it jeopardizes the"} AGPBI: {"kind":"SIMPLE","text":"compatibility of your app with future versions of the platform.","position":{},"original":"compatibility of your app with future versions of the platform."} AGPBI: {"kind":"SIMPLE","text":"It is also often of questionable legality.","position":{},"original":"It is also often of questionable legality."} AGPBI: {"kind":"SIMPLE","text":"If you really intend to build a core library -- which is only","position":{},"original":"If you really intend to build a core library -- which is only"} AGPBI: {"kind":"SIMPLE","text":"appropriate as part of creating a full virtual machine","position":{},"original":"appropriate as part of creating a full virtual machine"} AGPBI: {"kind":"SIMPLE","text":"distribution, as opposed to compiling an application -- then use","position":{},"original":"distribution, as opposed to compiling an application -- then use"} AGPBI: {"kind":"SIMPLE","text":"the \"--core-library\" option to suppress this error message.","position":{},"original":"the \"--core-library\" option to suppress this error message."} AGPBI: {"kind":"SIMPLE","text":"If you go ahead and use \"--core-library\" but are in fact","position":{},"original":"If you go ahead and use \"--core-library\" but are in fact"} AGPBI: {"kind":"SIMPLE","text":"building an application, then be forewarned that your application","position":{},"original":"building an application, then be forewarned that your application"} AGPBI: {"kind":"SIMPLE","text":"will still fail to build or run, at some point. Please be","position":{},"original":"will still fail to build or run, at some point. Please be"} AGPBI: {"kind":"SIMPLE","text":"prepared for angry customers who find, for example, that your","position":{},"original":"prepared for angry customers who find, for example, that your"} AGPBI: {"kind":"SIMPLE","text":"application ceases to function once they upgrade their operating","position":{},"original":"application ceases to function once they upgrade their operating"} AGPBI: {"kind":"SIMPLE","text":"system. You will be to blame for this problem.","position":{},"original":"system. You will be to blame for this problem."} AGPBI: {"kind":"SIMPLE","text":"If you are legitimately using some code that happens to be in a","position":{},"original":"If you are legitimately using some code that happens to be in a"} AGPBI: {"kind":"SIMPLE","text":"core package, then the easiest safe alternative you have is to","position":{},"original":"core package, then the easiest safe alternative you have is to"} AGPBI: {"kind":"SIMPLE","text":"repackage that code. That is, move the classes in question into","position":{},"original":"repackage that code. That is, move the classes in question into"} AGPBI: {"kind":"SIMPLE","text":"your own package namespace. This means that they will never be in","position":{},"original":"your own package namespace. This means that they will never be in"} AGPBI: {"kind":"SIMPLE","text":"conflict with core system classes. JarJar is a tool that may help","position":{},"original":"conflict with core system classes. JarJar is a tool that may help"} AGPBI: {"kind":"SIMPLE","text":"you in this endeavor. If you find that you cannot do this, then","position":{},"original":"you in this endeavor. If you find that you cannot do this, then"} AGPBI: {"kind":"SIMPLE","text":"that is an indication that the path you are on will ultimately","position":{},"original":"that is an indication that the path you are on will ultimately"} AGPBI: {"kind":"SIMPLE","text":"lead to pain, suffering, grief, and lamentation.","position":{},"original":"lead to pain, suffering, grief, and lamentation."} AGPBI: {"kind":"SIMPLE","text":"1 error; aborting","position":{},"original":"1 error; aborting"}

FAILED

aborting"} FAILED FAILURE: Build failed with an exception.

  • exception. * What went wrong: Execution failed for task ':app:preDexDebug'.

    ':app:preDexDebug'. > com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_25\bin\java.exe'' finished with non-zero exit value 1

  • 1 * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

output. BUILD FAILED

FAILED