question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

(Android) java.lang.NoClassDefFoundError: Failed resolution of: Ljavax/xml/stream/XMLInputFactory

See original GitHub issue

I am trying to deserialise some XML and am getting the following exception.

I have these includes: implementation “com.fasterxml.jackson.module:jackson-module-kotlin:2.13.2” implementation(“com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.13.2”) implementation(“com.fasterxml.woodstox:woodstox-core:6.2.8”)

I can serialise/deserialize json fine, the issue is just with XML.

java.lang.NoSuchMethodError: No static method newFactory(Ljava/lang/String;Ljava/lang/ClassLoader;)Ljavax/xml/stream/XMLInputFactory; in class Ljavax/xml/stream/XMLInputFactory; or its super classes (declaration of 'javax.xml.stream.XMLInputFactory' appears in /data/app/~~uieaA4ZwQHgkIyUGH_LkxA==/com.clashcaddie.clashcaddie-xRbKiEW2_xNYMI-cfwHckQ==/base.apk!classes14.dex) at com.fasterxml.jackson.dataformat.xml.XmlFactory.<init>(XmlFactory.java:115) at com.fasterxml.jackson.dataformat.xml.XmlFactory.<init>(XmlFactory.java:101) at com.fasterxml.jackson.dataformat.xml.XmlFactory.<init>(XmlFactory.java:85) at com.fasterxml.jackson.dataformat.xml.XmlMapper.<init>(XmlMapper.java:127) at com.clashcaddie.clashcaddie.ui.caddieoverlay.GridSettingsOverlayViewModel.saveGrids(GridSettingsOverlayViewModel.kt:69) at com.clashcaddie.clashcaddie.ui.caddieoverlay.GridSettingsOverlayViewModel.applyGrids(GridSettingsOverlayViewModel.kt:53) at com.clashcaddie.clashcaddie.databinding.ActivityGridSettingsOverlayBindingImpl._internalCallbackOnClick(ActivityGridSettingsOverlayBindingImpl.java:283) at com.clashcaddie.clashcaddie.generated.callback.OnClickListener.onClick(OnClickListener.java:11) at android.view.View.performClick(View.java:7455) at android.view.View.performClickInternal(View.java:7432) at android.view.View.access$3700(View.java:835) at android.view.View$PerformClick.run(View.java:28810) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:201) at android.os.Looper.loop(Looper.java:288) at android.app.ActivityThread.main(ActivityThread.java:7842) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)

2022-06-22 13:54:26.194 17351-17351/com.clashcaddie.clashcaddie E/AndroidRuntime: FATAL EXCEPTION: main Process: com.clashcaddie.clashcaddie, PID: 17351 java.lang.NoClassDefFoundError: Failed resolution of: Ljavax/xml/stream/XMLInputFactory; at com.fasterxml.jackson.dataformat.xml.XmlFactory.<init>(XmlFactory.java:115) at com.fasterxml.jackson.dataformat.xml.XmlFactory.<init>(XmlFactory.java:101) at com.fasterxml.jackson.dataformat.xml.XmlFactory.<init>(XmlFactory.java:85) at com.fasterxml.jackson.dataformat.xml.XmlMapper.<init>(XmlMapper.java:127) at com.clashcaddie.clashcaddie.ui.caddieoverlay.GridSettingsOverlayViewModel.saveGrids(GridSettingsOverlayViewModel.kt:66) at com.clashcaddie.clashcaddie.ui.caddieoverlay.GridSettingsOverlayViewModel.applyGrids(GridSettingsOverlayViewModel.kt:50) at com.clashcaddie.clashcaddie.databinding.ActivityGridSettingsOverlayBindingImpl._internalCallbackOnClick(ActivityGridSettingsOverlayBindingImpl.java:283) at com.clashcaddie.clashcaddie.generated.callback.OnClickListener.onClick(OnClickListener.java:11) at android.view.View.performClick(View.java:7455) at android.view.View.performClickInternal(View.java:7432) at android.view.View.access$3700(View.java:835) at android.view.View$PerformClick.run(View.java:28810) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:201) at android.os.Looper.loop(Looper.java:288) at android.app.ActivityThread.main(ActivityThread.java:7842) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003) Caused by: java.lang.ClassNotFoundException: Didn't find class "javax.xml.stream.XMLInputFactory" on path: DexPathList[[dex file "/data/data/com.clashcaddie.clashcaddie/code_cache/.overlay/base.apk/classes4.dex", dex file "/data/data/com.clashcaddie.clashcaddie/code_cache/.overlay/base.apk/classes.dex", dex file "/data/data/com.clashcaddie.clashcaddie/code_cache/.overlay/base.apk/classes14.dex", zip file "/data/app/~~NbB0p3D0j-XgvmhaM3JYmg==/com.clashcaddie.clashcaddie-cnHJSvUA99dufgkz2-Gs7g==/base.apk"],nativeLibraryDirectories=[/data/app/~~NbB0p3D0j-XgvmhaM3JYmg==/com.clashcaddie.clashcaddie-cnHJSvUA99dufgkz2-Gs7g==/lib/arm64, /system/lib64, /system_ext/lib64]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:218) at java.lang.ClassLoader.loadClass(ClassLoader.java:379) at java.lang.ClassLoader.loadClass(ClassLoader.java:312) at com.fasterxml.jackson.dataformat.xml.XmlFactory.<init>(XmlFactory.java:115)  at com.fasterxml.jackson.dataformat.xml.XmlFactory.<init>(XmlFactory.java:101)  at com.fasterxml.jackson.dataformat.xml.XmlFactory.<init>(XmlFactory.java:85)  at com.fasterxml.jackson.dataformat.xml.XmlMapper.<init>(XmlMapper.java:127)  at com.clashcaddie.clashcaddie.ui.caddieoverlay.GridSettingsOverlayViewModel.saveGrids(GridSettingsOverlayViewModel.kt:66)  at com.clashcaddie.clashcaddie.ui.caddieoverlay.GridSettingsOverlayViewModel.applyGrids(GridSettingsOverlayViewModel.kt:50)  at com.clashcaddie.clashcaddie.databinding.ActivityGridSettingsOverlayBindingImpl._internalCallbackOnClick(ActivityGridSettingsOverlayBindingImpl.java:283)  at com.clashcaddie.clashcaddie.generated.callback.OnClickListener.onClick(OnClickListener.java:11)  at android.view.View.performClick(View.java:7455)  at android.view.View.performClickInternal(View.java:7432)  at android.view.View.access$3700(View.java:835)  at android.view.View$PerformClick.run(View.java:28810)  at android.os.Handler.handleCallback(Handler.java:938)  at android.os.Handler.dispatchMessage(Handler.java:99)  at android.os.Looper.loopOnce(Looper.java:201)  at android.os.Looper.loop(Looper.java:288)  at android.app.ActivityThread.main(ActivityThread.java:7842)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003) 

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
farmisencommented, Jul 13, 2022

@clashcaddie

After adding implementation 'javax.xml.stream:stax-api:1.0-2' to my dependencies the following works for me:

val xmlFactory = XmlFactory.builder()
                .xmlInputFactory(WstxInputFactory()) 
                .xmlOutputFactory(WstxOutputFactory())
                .build()
0reactions
cowtowncodercommented, Aug 31, 2022

Ah… that’s unfortunate but not surprising. I would take a PR against 2.14 to use the old “deprecated” method if that helps Android compatibility.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ljavax/XML/stream/XMLEventFactory with Apache POI on ...
NoClassDefFoundError : Failed resolution of :Ljavax/XML/stream/XMLEventFactory with Apache POI on Android · Can you provide your project's libraries? – Voicu · I ...
Read more >
java.lang.NoClassDefFoundError: Failed resolution of: Ljavax ...
This is only happening with Android 9 devices. Using the evernote android sdk. I've upgraded my targetSdkVersion to 28 and migrated to ...
Read more >
java.lang.NoClassDefFoundError Failed resolution of: Lbgyx
Im Getting following exception for one of my app users in production, Here ?Im giving stack trace and other details. Gradle dependencies :....
Read more >
Failed NoClassDefFoundError for android.view ... - Issue Tracker
Class<android.support.v4.view.ViewCompat$OnUnhandledKeyEventListenerWrapper>: java.lang.NoClassDefFoundError: Failed resolution of: ...
Read more >
Android 中读写Excel数据- 简书
java.lang.NoClassDefFoundError: Failed resolution of: Ljavax/xml/stream/XMLEventFactory;.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found