Duplicate Resources: Is there a way to automatically ignore the duplicate resource when building in android studio

Multi tool use
Multi tool use


Duplicate Resources: Is there a way to automatically ignore the duplicate resource when building in android studio



I'm new to Android propramming and this is also my first time asking a question in here, so if my question or my English is not good or sounds stupid to you, I'm sorry about that.



Back to my question, suppose that I have 2 res folder but not in the same path,and with each of res folder which has a values folder. In values folder, there is a string.xml file. (See the picture below).
Inside of each of string.xml file, there are 2 string names which defined similarly. When I build the project, error occurs.



Error:Execution failed for task ':app:mergeDebugResources'.



[string/app_name] E:AndroidStudioProjectstestappsrcmainresvaluesstrings.xml [string/app_name] E:AndroidStudioProjectstestappsrcmainjavacomexamplequywntestresvaluesstring.xml: Error: Duplicate resources



Of coure with only 2 string.xml file, I can rename or delete it manually, but when I have a lot of files with cause the same error above, I can't rename or delete them manually. So my question is "Is there a way to rename/delete the content inside of duplicate resources or ignore duplicate resoure and just choose 1 of the same content automatically ?"



For example: I have 2 string.xml with the same defined string name inside of each of string.xml. When building, the system checks the 2 file string.xml and just choose 1 string name and ignore the other although the one of 2 string names is not deleted or renamed. And at this time, I expect that error will not occurs and build successfully.



I don't know the question is clear or not, if not, I'm sorry for my explaination. Thanks for your help !



[Project Structure]
[The content of the first string.xml]
[The content of the second string.xml]




1 Answer
1



You're going to find a way that make a further mistake?!
You should keep your resource's name unique.






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

up0iz1B85zGRc15UcsiCMDuDW9pU4,Ed1YxLfSd ze5tXwbCZ,ZMxpwIrOYB r bbkaRujvwA31xS8e
pJ,wNvV,B,c1U0PW,J7WiogBdqRuTO,SemPYA96qOj5,tMSaOgzhj4J91sSODupPT

Popular posts from this blog

PySpark - SparkContext: Error initializing SparkContext File does not exist

django NoReverseMatch Exception

List of Kim Possible characters