Gradle Cannot Resolve Symbol Xmlparser()

Gradle Cannot Resolve Symbol Xmlparser()

I have the an implementation in one of my build.gradle files of an Android app that I was using to check some data in the resource file.

new XmlParser().parse(stringsFile).string.find { [email protected] keyName }.text()

This seemed to have been working fine until I decided to upgrade the following

  • To API Level 32 from 30
  • Gradle from 6.5 to 7.3.

Now I am getting the error 'Cannot find Symbol XmlParser'.

There is no indication of this class being deprecated and I can find it in Groovy documentation. Basically I am trying to read a value from one of the resource xml files in one of the build steps.

1 Answer

Since groovy 4 the package for xml classes has been changed from groovy.util to groovy.xml.

So, now you have to import it differently

import groovy.xml.XmlParser

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Elena Rostova
Author

Elena Rostova

Elena Rostova holds a Master's degree in Public Health Journalism. She covers groundbreaking medical research, holistic wellness trends, mental health awareness, and nutritional science.