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

后端 未结 9 1027
傲寒
傲寒 2021-01-30 03:03

I have a huge Android project with many strings declared in strings.xml. I wanted to remove unused strings in strings.xml.

Is there any easy wa

相关标签:
9条回答
  • 2021-01-30 03:34

    In my case "Run Inspection by Name" didnt work, despite the fact I was using "Remove unused resources".

    Solution:

    1. Open strings.xml
    2. Secondary click
    3. Refactor --> Remove Unused Resources

    I have no clue why "Remove Unused Resources" works one way but not the other.

    0 讨论(0)
  • 2021-01-30 03:34

    To check string.xml.

    It's easy (at least in my version of Eclipse)

    In Eclipse for Android (I have version v22.6.2-1085508)

    • Right click on the project name in "Package explorer"
    • Select "Android Tools".
    • Select "Run Lint: Check for common Errors".

    Now when you open strings.xml, you will see that unused string are highlighted.

    You can fix other potential issues.

    0 讨论(0)
  • 2021-01-30 03:34

    In Android Studio Press

    Ctlr+Alt+Shift+i

    Select -> Unused resources
    It shows you unused unused strings and icons.

    Thanks Happy coding :)

    0 讨论(0)
提交回复
热议问题