由于“存在不同情况的资源”错误,Eclipse 项目未在 Mac 上构建

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/513676/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 18:37:10  来源:igfitidea点击:

Eclipse project not built on Mac due to 'A resource exists with a different case' error

eclipsemacos

提问by yinglcs

I am trying to following instructions to import android java source to eclipse on mac:

我正在尝试按照说明将 android java 源导入到 mac 上的 eclipse:

http://source.android.com/source/using-eclipse.html

http://source.android.com/source/using-eclipse.html

I did create a new partition ('Mac OS Extended, case sensitive, journaled) on Mac. I was able to build android sdk successfully at command line.

我确实在 Mac 上创建了一个新分区('Mac OS 扩展,区分大小写,日志)。我能够在命令行成功构建 android sdk。

But when I try to create a new eclipse project and I get this error which prevents eclipse from building the android source:

但是当我尝试创建一个新的 eclipse 项目时,我收到了这个错误,它阻止了 eclipse 构建 android 源代码:

The project was not built due to "A resource exists with a different
case: '/android/out/target/common/obj/JAVA_LIBRARIES/
android_stubs_current_intermediates/classes/MANIFEST.mf'.". 
Fix the problem, then try refreshing this project and building it since it may
be inconsistent android

Can you please tell me how can to fix my problem?

你能告诉我如何解决我的问题吗?

回答by ajh158

I just ran into this issue. It occurs when you have a case mismatch on package names. I resolved it by closing Eclipse and reconciling all package names in my project folder (under bin, gen and src) as well as in my AndroidManifest.xml. Once everything matched, I reopened Eclipse, did a Clean and Build and the error went away.

我刚刚遇到了这个问题。当包名称大小写不匹配时会发生这种情况。我通过关闭 Eclipse 并协调我的项目文件夹(在 bin、gen 和 src 下)以及我的 AndroidManifest.xml 中的所有包名称来解决它。一切匹配后,我重新打开 Eclipse,执行 Clean and Build,错误消失了。

回答by Ally

I encountered this problem when I had 2 seperate packages with different case defined in same project

当我在同一个项目中定义了 2 个不同大小写的单独包时遇到了这个问题

src/main -> com.mycompany.project.DAO

src/main -> com.mycompany.project.DAO

src/test > com.mycompany.project.dao

源代码/测试> com.mycompany.project.dao

Actually the 2nd package was for JUnit test cases & should not have been on build path. When I removed the 2nd package from build path (rightclick src/test -> remove from build path), this error was gone.

实际上,第二个包是用于 JUnit 测试用例的,不应该在构建路径上。当我从构建路径中删除第二个包时(右键单击 src/test -> 从构建路径中删除),这个错误消失了。

回答by Nitin Bansal

Just check your Manifest file. The package name/path should be correct. Then just delete R.java file, and clean the project. If dat doesnt solve the problem, close eclipse, and start again. I faced same issue on windows.

只需检查您的清单文件。包名/路径应该是正确的。然后只需删除 R.java 文件,并清理项目。如果dat没有解决问题,关闭eclipse,重新开始。我在 Windows 上遇到了同样的问题。

回答by Rahul N

Right click on your project, select Build Path -> Configure Build Path. Under "Source Project" tab check the case of the word "BIN". if BIN is in caps then make it the same as it is in your project tree hierarchy.

右键单击您的项目,选择构建路径 -> 配置构建路径。在“源项目”选项卡下检查单词“BIN”的大小写。如果 BIN 为大写,则使其与项目树层次结构中的相同。

回答by Nick Jian

Just solve the same problem.

只需解决同样的问题。

Clean project and Delete R file.

清理项目并删除 R 文件。

Restart eclipse, then check "Problems" tab

重新启动 eclipse,然后检查“问题”选项卡

I found two R file is mismatch, correct it and problem solved!

我发现两个 R 文件不匹配,纠正它并解决问题!

回答by vish

For me what worked was "switch workspace" to a new one. (because the old one was contaminated )

对我来说,有效的是“切换工作区”到一个新的工作区。(因为旧的被污染了)

回答by Cat

I had the same issue when importing an existing project into Eclipse. I named the new project package com.example.myprojectbut the old activity was referencing package com.example.MyProject(notice the uppercasing difference). After I renamed the package the project built fine.

将现有项目导入 Eclipse 时,我遇到了同样的问题。我命名了新项目包,com.example.myproject但旧活动正在引用package com.example.MyProject(注意大写差异)。在我重命名包后,项目构建得很好。

回答by do01

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

1_将清单 XML 标记中的“package”参数与 Src Java 文件中的包名称完全匹配。

com.example.myapp is notcom.example.MyApp

com.example.myapp不是com.example.MyApp

2_delete all things in Gen folder

2_删除 Gen 文件夹中的所有内容

3_Project -> Clean

3_项目 -> 清洁

enjoy :)

享受:)

回答by Eric

Tried many of the above resolutions myself. I found it was better to just remove the application from my workspace and re-Import it. Resolved itself after that.

自己尝试了许多上述决议。我发现最好从我的工作区中删除应用程序并重新导入它。之后自行解决。

回答by Imran Khan

It is because of your jar file. remove the jar and add correct jar.

这是因为你的 jar 文件。取出罐子并添加正确的罐子。