Gradle Build error due to duplicate entry in strings.xml

In my current lines of the Android project, the ones mentioned below are used based on the product:

<string name="insert_sd_card" product="nosdcard">"Por favor, inserte una tarjeta SD"  </string>
<string name="insert_sd_card" product="default">"Por favor, inserte una tarjeta SD"</string>

When I started the Gradle construct (tried with 0.7, 0.8, 0.9), I get the following error:

* \ res \ values-es \ strings.xml: Error: found String / insertsdcard element more than once

+5
source share
3 answers

Per documentation , the XML string attribute "name" is used as a resource identifier by the Android system. In other words, you cannot have two lines with the same "name" attribute, even if they differ in other attributes.

0
source

It looks like you called the same value twice

<string name="insert_sd_card" and <string name="insert_sd_card"

just rename one of 'insert_sd_card'to any other name, for example'place_sd_card'

Thus, < string name="insert_sd_card"becomes<string name="place_sd_card"

It might work.

0
source

Source: https://habr.com/ru/post/1532668/


All Articles