Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Maven build gives trouble processing "javax/xml/namespace/QName.class":

Following error is showing in Maven console everytime I do Project -> Clean. Only the jar file is built in the target folder, apk file is not getting built. Can anyone please help me to solve this issue?

Regards,

Sam.

My development environment is;

  • Eclipse Helios
  • Android SDK API level 8
  • Eclipse ADT 10.0.1
  • Maven Integration for Android Development Tools 0.2.5

4/30/11 9:54:07 PM IST: [INFO] skip non existing resourceDirectory D:\my\workspace\android\android-test-app\src\test\resources 4/30/11 9:54:07 PM IST: [INFO] Not compiling test sources 4/30/11 9:54:07 PM IST: [INFO] Tests are skipped. 4/30/11 9:54:07 PM IST: [INFO] D:\my\android-sdk-my\android-sdk-windows/platform-tools/dx.bat [--dex, --output=D:\my\workspace\android\android-test-app\target\classes.dex, D:\my\workspace\android\android-test-app\target\android-classes] 4/30/11 9:54:17 PM IST: [INFO] 4/30/11 9:54:17 PM IST: [INFO] trouble processing "javax/xml/namespace/QName.class": 4/30/11 9:54:17 PM IST: [INFO] 4/30/11 9:54:17 PM IST: [INFO] Ill-advised or mistaken usage of a core class (java.* or javax.*) 4/30/11 9:54:17 PM IST: [INFO] when not building a core library. 4/30/11 9:54:17 PM IST: [INFO] 4/30/11 9:54:17 PM IST: [INFO] This is often due to inadvertently including a core library file 4/30/11 9:54:17 PM IST: [INFO] in your application's project, when using an IDE (such as 4/30/11 9:54:17 PM IST: [INFO] Eclipse). If you are sure you're not intentionally defining a 4/30/11 9:54:17 PM IST: [INFO] core class, then this is the most likely explanation of what's 4/30/11 9:54:17 PM IST: [INFO] going on. 4/30/11 9:54:17 PM IST: [INFO] 4/30/11 9:54:17 PM IST: [INFO] However, you might actually be trying to define a class in a core 4/30/11 9:54:17 PM IST: [INFO] namespace, the source of which you may have taken, for example, 4/30/11 9:54:17 PM IST: [INFO] from a non-Android virtual machine project. This will most 4/30/11 9:54:17 PM IST: [INFO] assuredly not work. At a minimum, it jeopardizes the 4/30/11 9:54:17 PM IST: [INFO] compatibility of your app with future versions of the platform. 4/30/11 9:54:17 PM IST: [INFO] It is also often of questionable legality. 4/30/11 9:54:17 PM IST: [INFO] 4/30/11 9:54:17 PM IST: [INFO] If you really intend to build a core library -- which is only 4/30/11 9:54:17 PM IST: [INFO] appropriate as part of creating a full virtual machine 4/30/11 9:54:17 PM IST: [INFO] distribution, as opposed to compiling an application -- then use 4/30/11 9:54:17 PM IST: [INFO] the "--core-library" option to suppress this error message. 4/30/11 9:54:17 PM IST: [INFO] 4/30/11 9:54:17 PM IST: [INFO] If you go ahead and use "--core-library" but are in fact 4/30/11 9:54:17 PM IST: [INFO] building an application, then be forewarned that your application 4/30/11 9:54:17 PM IST: [INFO] will still fail to build or run, at some point. Please be 4/30/11 9:54:17 PM IST: [INFO] prepared for angry customers who find, for example, that your 4/30/11 9:54:17 PM IST: [INFO] application ceases to function once they upgrade their operating 4/30/11 9:54:17 PM IST: [INFO] system. You will be to blame for this problem. 4/30/11 9:54:17 PM IST: [INFO] 4/30/11 9:54:17 PM IST: [INFO] If you are legitimately using some code that happens to be in a 4/30/11 9:54:17 PM IST: [INFO] core package, then the easiest safe alternative you have is to 4/30/11 9:54:17 PM IST: [INFO] repackage that code. That is, move the classes in question into 4/30/11 9:54:17 PM IST: [INFO] your own package namespace. This means that they will never be in 4/30/11 9:54:17 PM IST: [INFO] conflict with core system classes. JarJar is a tool that may help 4/30/11 9:54:17 PM IST: [INFO] you in this endeavor. If you find that you cannot do this, then 4/30/11 9:54:17 PM IST: [INFO] that is an indication that the path you are on will ultimately 4/30/11 9:54:17 PM IST: [INFO] lead to pain, suffering, grief, and lamentation. 4/30/11 9:54:17 PM IST: [INFO] 4/30/11 9:54:17 PM IST: [INFO] 1 error; aborting

like image 917
Sam Avatar asked Apr 30 '11 16:04

Sam


2 Answers

If your are using android maven integration, you should add the "provided" scope in your android sdk dependency.

<dependency>        
<groupId>com.google.android</groupId>        
<artifactId>android</artifactId>        
<version>2.3.3</version>        
<scope>provided</scope>        
</dependency>
like image 138
alexfdz Avatar answered Nov 13 '22 03:11

alexfdz


You can exclude implicit dependencies using the exclude-tag. QName seems to be in e.g. the xpp3 package. I solved this problem by adding the following exclusions to my pom (that already contained the dependency to google-api-client-googleapis):

<dependency>
  <groupId>com.google.api.client</groupId>
  <artifactId>google-api-client-googleapis</artifactId>
  <version>1.4.1-beta</version>
  <exclusions>
    <exclusion>
      <groupId>commons-logging</groupId>
      <artifactId>commons-logging</artifactId>
    </exclusion>
    <exclusion>
      <groupId>xpp3</groupId>
      <artifactId>xpp3</artifactId>
    </exclusion>
</exclusions>
</dependency>

If you need to find where the conflicting class files come from, run for example:

for x in `find ~/.m2/repository/ -name \*.jar`; do jar tf $x|grep QName.class && echo "Found in: $x"; done`
like image 28
levsa Avatar answered Nov 13 '22 02:11

levsa