pravn
pravn

Reputation: 13

Xerces in Android Studio

I'm trying to use spring-context in an Android project and have gotten as far as trying to load a context file. I'm getting this error:

Your JAXP provider ... does not support XML Schema. Are you running on Java 1.4 or below with Apache Crimson? Upgrade to Apache Xerces (or Java 1.5) for full XSD support.

I've found partial answers from a couple years ago indicating the fix is to include Xerces in my project.

I'm using Android Studio, which forces me to use Gradle. I can't for the life of me figure out what to use as the classpath to include Xerces in Gradle. Does anyone know what it is? Is Xerces even available to Gradle? Is there some newer, easier fix that I've missed?

Upvotes: 0

Views: 1005

Answers (2)

Petterson
Petterson

Reputation: 851

Xerces extends the core library javax.*. Extending core libraries is not allowed in Android. However you can use --core-library to suppress these warnings. However, this is not recommended. For more information see this.

You can overcome this problem by repackaging the needed classes with a tool like JarJar. This has been done in the Xerces-for-Android, wherein the package mf is placed above the "normal" Xerces packages.

Upvotes: 1

gdrt
gdrt

Reputation: 3325

Was that the only thing you wanted? :)

'xerces:xercesImpl:2.11.0'

Upvotes: 2

Related Questions