简体   繁体   中英

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 { it.@name.equals 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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM