Trying to use a java jar file on Android which uses Jackson lib. But 
getting the below errors, stack trace attached.
java.lang.NoClassDefFoundError: Failed resolution of: 
Ljavax/xml/bind/annotation/XmlElement; 
Background:
We have a  java archive file, which uses jackson library - JAXB Annotations 
for serializing to xml.We are trying call the functionality from Android 
app.  The same worked fine on windows. 


We are using the below gradle dependencies: 
implementation 
'com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.1.1'
implementation 'javax.xml.stream:stax-api:1.0-2'
implementation 'com.fasterxml:aalto-xml:1.0.0'
implementation group: 'com.fasterxml.jackson.module', name: 
'jackson-module-jaxb-annotations', version: '2.13.0'

Could someone please let me know what I am missing here. Does jackson works 
for Android to begin with?

Thanks.


-- 
You received this message because you are subscribed to the Google Groups 
"jackson-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jackson-user/466f39b2-3061-49d4-9ff5-ba613974bc28n%40googlegroups.com.
    Process: com.example.helloworld, PID: 25408
    java.lang.NoClassDefFoundError: Failed resolution of: 
Ljavax/xml/bind/annotation/XmlElement;
        at 
com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector.<init>(JaxbAnnotationIntrospector.java:108)
        at 
com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector.<init>(JaxbAnnotationIntrospector.java:95)
        at 
com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule.setupModule(JaxbAnnotationModule.java:55)
        at 
com.fasterxml.jackson.databind.ObjectMapper.registerModule(ObjectMapper.java:525)
        at Test.BookMain.JacksonSample(BookMain.java:92)
        at com.example.helloworld.MainActivity.sendMessage(MainActivity.java:41)
        at com.example.helloworld.MainActivity$1.onClick(MainActivity.java:34)
        at android.view.View.performClick(View.java:6642)
        at 
com.google.android.material.button.MaterialButton.performClick(MaterialButton.java:1119)
        at android.view.View.performClickInternal(View.java:6619)
        at android.view.View.access$3100(View.java:790)
        at android.view.View$PerformClick.run(View.java:26191)
        at android.os.Handler.handleCallback(Handler.java:873)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:224)
        at android.app.ActivityThread.main(ActivityThread.java:7143)
        at java.lang.reflect.Method.invoke(Native Method)
        at 
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:604)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:876)
     Caused by: java.lang.ClassNotFoundException: Didn't find class 
"javax.xml.bind.annotation.XmlElement" on path: DexPathList[[zip file 
"/data/app/com.example.helloworld-UwKQIvg1llCI6-k_jt__CQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.example.helloworld-UwKQIvg1llCI6-k_jt__CQ==/lib/arm64,
 /system/lib64, /system/product/lib64]]
        at 
dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
        at 
com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector.<init>(JaxbAnnotationIntrospector.java:108)
 
        at 
com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector.<init>(JaxbAnnotationIntrospector.java:95)
 
        at 
com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule.setupModule(JaxbAnnotationModule.java:55)
 
        at 
com.fasterxml.jackson.databind.ObjectMapper.registerModule(ObjectMapper.java:525)
 
        at Test.BookMain.JacksonSample(BookMain.java:92) 
        at 
com.example.helloworld.MainActivity.sendMessage(MainActivity.java:41) 
        at com.example.helloworld.MainActivity$1.onClick(MainActivity.java:34) 
        at android.view.View.performClick(View.java:6642) 
        at 
com.google.android.material.button.MaterialButton.performClick(MaterialButton.java:1119)
 
        at android.view.View.performClickInternal(View.java:6619) 
        at android.view.View.access$3100(View.java:790) 
        at android.view.View$PerformClick.run(View.java:26191) 
        at android.os.Handler.handleCallback(Handler.java:873) 
        at android.os.Handler.dispatchMessage(Handler.java:99) 
        at android.os.Looper.loop(Looper.java:224) 
        at android.app.ActivityThread.main(ActivityThread.java:7143) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at 
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:604)
 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:876) 

Reply via email to