5

Are there other ways to check for duplicate string resource in Android?

say I have these 2 strings:

<!-- some other strings -->
<string name="A">I'm A</string>
<string name="A">I'm A</string>
<!-- some other strings -->

In my Eclipse, this doesn't cause any error or warnings, even if I tried using lint it does not show up. How can I see such problems then?

6
  • What are you trying to achieve ? Commented Oct 15, 2013 at 6:33
  • well, I want a way to check for duplicated string resource to eliminate them. A colleague of mine tried to build my project using Android Studio and was not able to do so due to this problem. Commented Oct 15, 2013 at 6:36
  • you will get a error resource entry already defined here Commented Oct 15, 2013 at 6:38
  • I was expecting that kind of error but the problem is, that does not appear at all Commented Oct 15, 2013 at 6:39
  • Clean your project and check. Commented Oct 15, 2013 at 6:40

2 Answers 2

4

In eclipse:

  1. Open your project properties
  2. Select Android Lint Preferences
  3. Make sure the DuplicateDefinition flag is selected.

This will pop up a warning each time you have a duplicate resource in one of your resource files.

Hope this helps :)

Sign up to request clarification or add additional context in comments.

Comments

1

In your Project Properties , in Android Lint preferences section you can set warning/error on Duplicate definition on resources

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.