I use Jackson 2.8.2 in my Android app to deserialize JSON. The deserialization itself works, however, I can see the following warning in the application log:
Unable to load JDK7 types (annotations, java.nio.file.Path): no Java7 support added
Proguard is disabled, sourceCompatibility
is set to '1.7'
. How can I add these seemingly missing types to my build?
Best Answer
First, your
sourceCompatibility
setting of1.7
doesn't mean anything about the runtime environment, so it has no impact on this message.This is purely a "do these classes exist at the time Jackson initializes this class" issue -- and they do not exist in some combination. And maybe that is ok, if you do not use the Java 7
java.nio.file.Path
class then you should have no issue with this logged warning message. Because that is what this warning is about, Jackson supporting serialization/deserialization of this specific class.Looking at Android
java.nio.*
packages, it does not havejava.nio.file.*
packages at any API level. So that explains why you see the warning message. And since you can't usejava.nio.file.Path
anyway, this isn't even a real issue other than an annoying logging message.If this message is bothersome you can always set the Java Util Logging level for logger
com.fasterxml.jackson.databind.ext.Java7Support
to be levelERROR
. Then you will no longer see these warning messages.More about the logged message:
In Jackson 2.8.x this support for Java 7 class
java.nio.file.Path
is all loading from the same JAR file and is built-in. One class dynamically checks if another can load without error:The only way this can fail is if something is stripping this class from the final set of classes. Or one of these classes it depends on is missing from the runtime:
If any of those are missing then you will see the logged error message. So one of these is true:
com.fasterxml.jackson.databind.ext.Java7SupportImpl
is missing at runtimeNeither of those causes are Jackson's fault, they are something about your runtime environment (i.e. they don't exist in Android API's), or Proguard stripping classes it doesn't think are used.
See also: