Mechazawa
Mechazawa

Reputation: 83

A resource exists with a different case

I'm unable to build my android app due to a strange error:

Description Resource Path Location Type The project was not built due to "A resource exists with a different case: '/ProjectName/bin/classes/com/Name/ProjectName'.". Fix the problem, then try refreshing this project and building it since it may be inconsistent ProjectName Unknown Java Problem

My file structure is the following: http://pastebin.com/6P6mEftD

I checked for files that had almost the same name and I couldn't find any. This was marked as the solution in a previously asked question that described the same error.

Upvotes: 11

Views: 27771

Answers (10)

Jorgesys
Jorgesys

Reputation: 126455

My problem was the incorrect package names defined in AndroidManifest.xml file, remember the packages name are case-sensitive, then just a Clean > Build Project

update: sometimes is necessary a "hard reset" of the project deleting the folders /gen and /bin, then Build Project

Upvotes: 0

Hamid Zandi
Hamid Zandi

Reputation: 2902

1_ match "package" parameter in the manifest XML tag exactly with the package name in Src Java files.

com.example.myapp is not com.example.MyApp

2_ delete all things in Gen folder

3_ Project -> Clean

enjoy :)

Upvotes: 0

WoffOVkee
WoffOVkee

Reputation: 455

I modified my AndroidManifest.xml but somehow it was rolled back when I tried to rebuild.

Than I tried edit class name from gen folder using 'Refactor > Rename'.

I changed my class name from xxxxLib to xxxlib (lowercase).

It solved my problem.

Upvotes: 0

user1062589
user1062589

Reputation: 177

I fixed it by removing all files under the target directory and letting the automatic rebuild execute.

Upvotes: 0

Roy
Roy

Reputation: 741

I copied project 'src' files from one project to another. In there I made a mistake in renaming the project folder as (com\company\projectName). The project folder name is expected to be all lower case. Then I deleted the bin & gen folders and rebuilt the project. All set.

Hope this helps.

Upvotes: 0

Ciro Rizzo
Ciro Rizzo

Reputation: 492

Assure Package name has exactly same in Android Manifest and in the sources

Upvotes: 0

Totalys
Totalys

Reputation: 465

I just had this error and I studied a lot to solve it.

Here it goes:

All answers you might find, may be correct because there're differents causes for it. To solve this issue, you must look into the "R.java" generated in the "gen" folder.

Once you opened it, look for two class that has the same name but is written with different cases. Example (mine): "String" ... "string"

Then, you will figure out that you miss spelt some thing. You never use Upcase letter to call strings at the xml file.

Example: android:contentDescription="@+String/imageView2"
DO NOT write string with capital S.

use:

android:contentDescription="@+string/imageView2" instead.

Once you locate the string you need to find where you put it with the find command. Once you correct the "grammar", just clean your project.

Pease.

TMA.

Upvotes: 3

Totalys
Totalys

Reputation: 465

I had this problem. I follow Pauland and I deleted my bin folder. But nothing happened. Then I close the project and it openned with no errors anymore.

Upvotes: 0

Doug N
Doug N

Reputation: 466

I had the same "resource exists with a different case" error.

The fix I had to make was in the AndroidManifest.xml file. My "package" parameter in the manifest XML tag did not exactly match the package name in my Java files. I suggest you look in the manifest XML and see if you spot the naming issue there.

Upvotes: 45

Pauland
Pauland

Reputation: 2014

Try to remove the bin folder and "Clean project".

Upvotes: 1

Related Questions