In my Android app I have a lot of strings in strings.xml that never get used because I removed the code modules that referenced them. Is there an automatic way in Eclipse or using some other tool that will remove those strings?
Definition of String in XML. XML Schema defines in a way what an XML document contains, therefore, XSD defines the string so, it can be defined as a value that contains character strings also has Unicode character given by XML and represented using the type xs: string, while this type has a white space character and maintained by ...
Clean strings.xml file helps to easily maintain and translate strings to different languages — screen after screen. If you want you can create strings.xml file per screen — settings-strings.xml, profile-strings.xml.
Unfortunately, StackOverflow was unable to help my for that, since I only found questions (and answers) related to stripping/removing non-UTF8 characters: close, yet still not enough for what I need, since there are a lot of legitimate UTF8 characters that might cause issues within a XML file.
How to Initialize String in XML? A string is initialized in the Element name with the type ‘string’. For example: It returns the string in the element name, if it is an integer then it returns a value. If the type doesn’t have any content then it could be declared as a string, not as any data types.
for i in $(lint . | grep 'The resource R.string.* appears to be unused' | perl -ne 'print "$1\n" if /R.string.(.*) appears/'); do perl -pi -e 's/.*<string name="'$i'".*\n//' res/values*/strings.xml; done
Android Lint can do it for you. Try: Right clic on your project > Android Tools > Run Lint: Check for Common Errors. Depending on your Lint settings, the unused strings will be shown.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With