title: JAXB and StAX: trouble processing "javax/xml/XMLConstants.class"
body: <p>I'm using <code>stax-api</code> and <code>jaxb-api</code> in one project. There's a problem with the class <code>javax.xml.XMLConstants</code>. I guess that's because both dependencies include this class. Am I right? Or is there another problem? Can I fix that without enabling multiDex (which doesn't work either btw.)?</p>
  
  <p>I'm using AndroidStudio. The problem occurs since I've added the <code>stax-api</code>.</p>
  
  <p>build.gradle (App):</p>
  
  <pre><code>android {
      compileSdkVersion 23
      buildToolsVersion '25.0.0'
      // ...
      defaultConfig {
          minSdkVersion 15
          targetSdkVersion 23
          // ...
      }
  }
  dependencies {
      compile 'javax.xml.stream:stax-api:1.0'
      compile 'javax.xml.bind:jaxb-api:2.2.12'
      // ...
  }
  </code></pre>
  
  <p>Gradle Make output:</p>
  
  <pre><code>Information:Gradle: Executing tasks: [:app:assembleDebug, :app:libraries:swagger-android-client:assembleDebug]
  Information:Module "app" was fully rebuilt due to project configuration/dependencies changes
  Information:12.03.2017 15:09 - Compilation completed with 34 errors and 0 warnings in 30s 984ms
  Error:Gradle: trouble processing "javax/xml/XMLConstants.class":
  Error:Gradle: Ill-advised or mistaken usage of a core class (java.* or javax.*)
  Error:Gradle: when not building a core library.
  Error:Gradle: This is often due to inadvertently including a core library file
  Error:Gradle: in your application's project, when using an IDE (such as
  Error:Gradle: Eclipse). If you are sure you're not intentionally defining a
  Error:Gradle: core class, then this is the most likely explanation of what's
  Error:Gradle: going on.
  Error:Gradle: However, you might actually be trying to define a class in a core
  Error:Gradle: namespace, the source of which you may have taken, for example,
  Error:Gradle: from a non-Android virtual machine project. This will most
  Error:Gradle: assuredly not work. At a minimum, it jeopardizes the
  Error:Gradle: compatibility of your app with future versions of the platform.
  Error:Gradle: It is also often of questionable legality.
  Error:Gradle: If you really intend to build a core library -- which is only
  Error:Gradle: appropriate as part of creating a full virtual machine
  Error:Gradle: distribution, as opposed to compiling an application -- then use
  Error:Gradle: the "--core-library" option to suppress this error message.
  Error:Gradle: If you go ahead and use "--core-library" but are in fact
  Error:Gradle: building an application, then be forewarned that your application
  Error:Gradle: will still fail to build or run, at some point. Please be
  Error:Gradle: prepared for angry customers who find, for example, that your
  Error:Gradle: application ceases to function once they upgrade their operating
  Error:Gradle: system. You will be to blame for this problem.
  Error:Gradle: If you are legitimately using some code that happens to be in a
  Error:Gradle: core package, then the easiest safe alternative you have is to
  Error:Gradle: repackage that code. That is, move the classes in question into
  Error:Gradle: your own package namespace. This means that they will never be in
  Error:Gradle: conflict with core system classes. JarJar is a tool that may help
  Error:Gradle: you in this endeavor. If you find that you cannot do this, then
  Error:Gradle: that is an indication that the path you are on will ultimately
  Error:Gradle: lead to pain, suffering, grief, and lamentation.
  Error:Gradle: 1 error; aborting
  Error:Gradle: Execution failed for task ':app:transformClassesWithDexForDebug'.
  &gt; com.android.build.api.transform.TransformException: java.lang.RuntimeException: java.lang.RuntimeException: Unable to pre-dex 'C:\Users\armin\.gradle\caches\modules-2\files-2.1\javax.xml.stream\stax-api\1.0\a5be00d58ecaf5b01037b149f70e93ebcfb18fd1\stax-api-1.0.jar' to 'C:\Users\armin\StudioProjects\MyApp\app\build\intermediates\pre-dexed\debug\stax-api-1.0_5ef65f1cf66782d491b19b4710e1f54e44751b15.jar'
  </code></pre>