android+maven+googleapis error: trouble processing "javax/xml/namespace/QName.class":

1,376 views
Skip to first unread message

Aaron D'Souza

unread,
May 19, 2011, 12:35:35 AM5/19/11
to google-api-...@googlegroups.com
Hey folks,

I wanted to play with the new Tasks API via an Android app, so I set up my project in Eclipse (with the Maven + android integration).

Everything works great, up until the point I need to pull in the google-api-services-tasks-v1 maven artifact. At that point, running a maven install spits out the following error:

[INFO] trouble processing "javax/xml/namespace/QName.class":
[INFO] 
[INFO] Ill-advised or mistaken usage of a core class (java.* or javax.*)
[INFO] when not building a core library.
[INFO] 
[INFO] This is often due to inadvertently including a core library file
[INFO] in your application's project, when using an IDE (such as
[INFO] Eclipse). If you are sure you're not intentionally defining a
[INFO] core class, then this is the most likely explanation of what's
[INFO] going on.
[INFO] 
[INFO] However, you might actually be trying to define a class in a core
[INFO] namespace, the source of which you may have taken, for example,
[INFO] from a non-Android virtual machine project. This will most
[INFO] assuredly not work. At a minimum, it jeopardizes the
[INFO] compatibility of your app with future versions of the platform.
[INFO] It is also often of questionable legality.
[INFO] 
[INFO] If you really intend to build a core library -- which is only
[INFO] appropriate as part of creating a full virtual machine
[INFO] distribution, as opposed to compiling an application -- then use
[INFO] the "--core-library" option to suppress this error message.
[INFO] 
[INFO] If you go ahead and use "--core-library" but are in fact
[INFO] building an application, then be forewarned that your application
[INFO] will still fail to build or run, at some point. Please be
[INFO] prepared for angry customers who find, for example, that your
[INFO] application ceases to function once they upgrade their operating
[INFO] system. You will be to blame for this problem.
[INFO] 
[INFO] If you are legitimately using some code that happens to be in a
[INFO] core package, then the easiest safe alternative you have is to
[INFO] repackage that code. That is, move the classes in question into
[INFO] your own package namespace. This means that they will never be in
[INFO] conflict with core system classes. JarJar is a tool that may help
[INFO] you in this endeavor. If you find that you cannot do this, then
[INFO] that is an indication that the path you are on will ultimately
[INFO] lead to pain, suffering, grief, and lamentation.
[INFO] 
[INFO] 1 error; aborting
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 10.969s
[INFO] Finished at: Wed May 18 20:41:02 PDT 2011
[INFO] Final Memory: 13M/215M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.jayway.maven.plugins.android.generation2:maven-android-plugin:2.8.3:dex (default-dex) on project gtasks: MojoExecutionException: ANDROID-040-001: Could not execute: Command = /bin/sh -c cd /home/adsouza/workspace/gtasks && /home/adsouza/projects/android-sdk-linux_x86/platform-tools/dx --dex --output=/home/adsouza/workspace/gtasks/target/classes.dex /home/adsouza/workspace/gtasks/target/android-classes, Result = 1 -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:

My pom file is pretty boring, and is as follows:

<?xml version="1.0" encoding="UTF-8"?>
  <modelVersion>4.0.0</modelVersion>
  <groupId>net.randomprocesses</groupId>
  <artifactId>gtasks</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>apk</packaging>
  <name>gtasks</name>

  <repositories>
    <repository>
      <id>google-api-services</id>
    </repository>
  </repositories>

  <dependencies>
    <dependency>
      <groupId>com.google.android</groupId>
      <artifactId>android</artifactId>
      <version>2.2.1</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>com.google.api.services.tasks</groupId>
      <artifactId>google-api-services-tasks-v1</artifactId>
      <version>1.0.0-beta</version>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>com.jayway.maven.plugins.android.generation2</groupId>
        <artifactId>maven-android-plugin</artifactId>
        <version>2.8.3</version>
        <configuration>
          <androidManifestFile>${project.basedir}/AndroidManifest.xml</androidManifestFile>
          <assetsDirectory>${project.basedir}/assets</assetsDirectory>
          <resourceDirectory>${project.basedir}/res</resourceDirectory>
          <nativeLibrariesDirectory>${project.basedir}/src/main/native</nativeLibrariesDirectory>
          <sdk>
            <path>/home/adsouza/projects/android-sdk-linux_x86</path>
            <platform>10</platform>
          </sdk>
          <deleteConflictingFiles>true</deleteConflictingFiles>
          <undeployBeforeDeploy>true</undeployBeforeDeploy>
        </configuration>
        <extensions>true</extensions>
      </plugin>

      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>2.3.2</version>
        <configuration>
          <source>1.5</source>
          <target>1.5</target>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>

I can't think of anything that I could've done that's out of the ordinary. I have exactly one source file in the entire project, and I haven't manually tweaked the BUILD path or added any libraries outside of what Maven automatically pulls in once I specify the google-api-services-tasks-v1 dependency.

Any advice on what I can do here? I reproduced this error on my Mac laptop, as well as a Linux desktop. I'm happy to provide more info if it's useful.

Thanks!
Aaron

Yaniv Inbar (יניב ענבר)

unread,
May 19, 2011, 9:37:38 AM5/19/11
to google-api-...@googlegroups.com
Thanks for reporting the problem Aaron.  Would you kindly file a bug report about this:


I haven't tried the Maven Android plugin before, but it is certainly something that we'd like to support.

Would you kindly try this work around, and let me know if it fixes the problem?  Add this to the Google tasks dependency:

      <exclusions>

      <exclusion>

      <artifactId>xpp3</artifactId>

      <groupId>xpp3</groupId>

      </exclusion>

      </exclusions>


We are definitely not using XML for the Tasks API support, and even if we did, it is already part of the Android SDK (which may be the reason why the Maven plugin is showing an error).

Yaniv Inbar
Senior Software Engineer
Google Inc.

Aaron D'Souza

unread,
May 19, 2011, 11:29:04 AM5/19/11
to google-api-...@googlegroups.com
Hey Yaniv,

The fix doesn't work. Adding the exclusion to the tasks dependency doesn't remove it (since it seems it's a dependency of the core android libraries). Excluding it from the android dependency too results in the following error:

This line
LayoutInflater.from(getContext()).inflate(android.R.layout.simple_list_item_1, parent, false);
gives the following error:
The type org.xmlpull.v1.XmlPullParser cannot be resolved. It is indirectly referenced from required .class files

Lucas Covey

unread,
May 19, 2011, 7:46:34 AM5/19/11
to google-api-...@googlegroups.com
I encountered the same problem, though I was working with the google-api-client artifact rather than then google-api-services.  I had to set the dependency to exclude the xpp3 artifact.  In fact, I wound up having to exclude every dependency listed in the google-api-client pom other than guava:

    <dependency>
      <groupId>com.google.api.client</groupId>
      <artifactId>google-api-client</artifactId>
      <version>1.4.1-beta</version>
      <exclusions>
        <exclusion>
          <groupId>com.google.code.findbugs</groupId>
          <artifactId>jsr305</artifactId>
        </exclusion>
        <exclusion>
          <groupId>com.google.code.gson</groupId>
          <artifactId>gson</artifactId>
        </exclusion>
        <exclusion>
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.apache.httpcomponents</groupId>
          <artifactId>httpclient</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.codehaus.jackson</groupId>
          <artifactId>jackson-core-asl</artifactId>
        </exclusion>
        <exclusion>
          <groupId>xpp3</groupId>
          <artifactId>xpp3</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

Hope that helps,

Lucas

On Thu, May 19, 2011 at 12:35 AM, Aaron D'Souza <aaron....@gmail.com> wrote:

Yaniv Inbar (יניב ענבר)

unread,
Nov 11, 2011, 4:41:34 PM11/11/11
to google-api-...@googlegroups.com
Thanks for the feedback.  This should be fixed now.  Indeed you have to exclude xpp3, as well as some other libraries for this to work properly.  Difficult to figure out, but at least it works.

Yaniv Inbar
Senior Software Engineer
Google Inc.


Reply all
Reply to author
Forward
0 new messages