How can I find all fake or useless string values in string.xml file?

1.9k Views Asked by At

I have a big and messy string.xml file with 3000 records, which most of the values are useless and never used inside code. I want to find and omit those useless records automatically. Is there a way to find useless records inside string.xml file?

5

There are 5 best solutions below

1
On BEST ANSWER

Right click on strings.xml file: Click on Refractor and then on Remove Unused Resources. Click on Refractor in the confirm Dialog Box. Helper Image

0
On

Menu -> Analyze -> Run Inspection by Name -> Unused resources

Actual resource Is there any simple way to find out unused strings in Android project?

0
On

use (Remove Unused Resources) in Android Studio link

0
On

I would suggest the best way would be to load the XML into objects such as Python ElementTree. import xml.etree.ElementTree You can then easily Prune all the branches down easily before exporting as an XML file. To deal with XML on a string level is a nuisance.

0
On

I found the that using the lint check and the translations editor works like a charm.

Go Analyse -> Run inspection by name -> Unused resources.

Here i add a file mask to only show me the strings

with a file mask

After the check has ran go to the Translations Editor, find the key(s) right click and safe delete.

This checks of the resource can safely be deleted and deletes the key in all your locales.