Bhumit
Bhumit

Reputation: 338

Android studio get error "Execution failed for task ':app:mergeDebugResources'. Error Duplicate resources"

After converting an eclipse project into android studio I am getting below error:

Error:Execution failed for task ':app:mergeDebugResources'.
> [string/test] E:\Workspace\Calculators\app\src\main\res\values\strings_sizing.xml
  [string/test] E:\Workspace\Calculators\app\src\main\res\values\strings_conversion.xml: Error: Duplicate resources 

How can I resolve this error in Android Studio?

Upvotes: -1

Views: 4508

Answers (2)

Nitesh
Nitesh

Reputation: 147

In my case this error occurred due to the string resource in two different locations with same name. i.e., while creating project default string resource is created.

<string name="app_name">Application Name</string>

And another same string resource manually I have declared in Gradle

 def appName = "Application Name"

So this issue occurred. To solve this issue try to keep only one resource.

This is not only applied here, anywhere in the project if we define two resources with same name this issue may raise.

Upvotes: 2

EJK
EJK

Reputation: 12534

This error is telling you that you have the same string resource defined in 2 different files. The entry

<string name="test">...</string>

exists in both

  • app\src\main\res\values\strings_sizing.xml AND
  • app\src\main\res\values\strings_conversion.xml

(Note that I simulated this scenario in my Android Studio environment and the build produced the exact same error message that you have posted.)

Upvotes: 4

Related Questions