javapythonandroidpyjnius

Using Jnius to call w3c/Document


I have a very simple question. I'm trying to use Jnius to call the Document class: https://developer.android.com/reference/kotlin/org/w3c/dom/Document

To do so I've done this:

from jnius import autoclass

document=autoclass('org.w3c.dom.Document')

So later in my script I can use the document. function (i.e. document.getElementById()

However, this returns an exception:

jnius.jnius.JavaException: Class not found b'w3c/dom/Document'

Am I setting this up correctly?

Edit:

Just wanted to add, I get the same error if I do: autoclass('org.w3c.dom'), it still doesn't find the class


Solution

  • Someone on the kivy discord was able to answer this. I'll leave this up in case anyone else comes across this issue.

    I was using buildozer to compile to apk. To fix the above error you need to add: android.gradle_dependencies = org.w3c:dom:2.3.0-jaxb-1.0.6 to your .spec file