eclipse 如何调试错误“您的项目包含错误,请先修复它们,然后再在 android 中运行您的应用程序”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14064768/
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
How to debug the error "your project contains errors please fix them before running your application in android"
提问by sujay
i have just begun working on android platform.I installed both eclipse and android sdk.Now i wanted to run a basic hello world application. I just followed a tutorial and tried to run it but got the following error your project contains errors please fix them before running your applicationHow can i debug this and run the app on emulator please help me out
我刚刚开始在 android 平台上工作。我安装了 eclipse 和 android sdk。现在我想运行一个基本的 hello world 应用程序。我只是按照教程并尝试运行它但得到以下错误 您的项目包含错误请在运行您的应用程序之前修复它们我如何调试它并在模拟器上运行应用程序请帮助我
回答by Puneet
There are two possible problem.
有两个可能的问题。
Because of code
因为代码
Because of R.java
因为 R.java
Check your project for any red mark on any package, if there is any red mark check that class for compilation error, this may happen because of wrong syntax,
检查您的项目是否有任何包上的任何红色标记,如果有任何红色标记检查该类是否有编译错误,这可能是因为语法错误,
or if you are unable to find R.java in your code, please check your RES folder for any possible error.
或者如果您在代码中找不到 R.java,请检查您的 RES 文件夹是否有任何可能的错误。
If you are not able to find any such error then clean and build your project from Project-->Clean(Select your project)-->Build Your project.
如果您找不到任何此类错误,请从 Project-->Clean(Select your project)-->Build Your project 中清理并构建您的项目。
If you are using any external jar file please add them in build path. right click on project-->buildpath-->configure build path-->library-->add external jar-->order them
如果您使用任何外部 jar 文件,请将它们添加到构建路径中。右键项目-->buildpath-->configure build path-->library-->add external jar-->order them
Check your min version and max version of project in manifest file, version of project u r using.
检查清单文件中项目的最小版本和最大版本,您使用的项目版本。
If still you are not able to compile then post your code here we will compile for you :)
如果您仍然无法编译,请在此处发布您的代码,我们将为您编译:)
回答by sujay
i had to delete the debug.keystore file which is present in .android folder and had to relaunch the eclipse.that fixed my problem
我不得不删除存在于 .android 文件夹中的 debug.keystore 文件,并且不得不重新启动 eclipse.that 解决了我的问题
回答by Sahil Mahajan Mj
If you have just installed the Eclipse, the most usual solution might be to Restart your Eclipse.
If it still doesnt work, then there might be some issue with your
res
folder, Check that-- There should not be duplicate files in the
layout
,Drawable
folders and otherres
sub folders. - No name in the
res
folders should s=have capital letters in it.
- There should not be duplicate files in the
Remove, if any import android.R;
如果您刚刚安装了 Eclipse,最常用的解决方案可能是重新启动 Eclipse。
如果它仍然不起作用,那么您的
res
文件夹可能存在一些问题,请检查-layout
,Drawable
文件夹和其他res
子文件夹中不应有重复的文件。res
文件夹中的任何名称都不应包含大写字母。
删除,如果有的话,导入 android.R;
Also, have a look at this Answer, R.java not resolved error
另外,看看这个答案,R.java没有解决错误
回答by Brijesh Thakur
Basically , this error occurs when your project is not being compiled properly. Few quick solutions 1. Clean your project and Build from Project --> Clean and Project --> Build 2. Check Java compiler setting of your project. Make sure you are targeting right JDK. 3. Check the Android Version of the project. (i.e.) Your Android SDK should have required android version to compile and build the apk.
基本上,当您的项目未正确编译时会发生此错误。几个快速解决方案 1. 清理项目并从项目构建 --> 清理和项目 --> 构建 2. 检查项目的 Java 编译器设置。确保您的目标是正确的 JDK。3.检查项目的Android版本。(ie) 您的 Android SDK 应该需要 android 版本来编译和构建 apk。
Try the above three. Your problem should get fixed.
试试上面三个。你的问题应该得到解决。
回答by Subburaj
DO this step:
做这一步:
1.Right click
your project and go for Android tools
and in that select "FIx Project properties"
.
1.Right click
你的项目,然后去Android tools
选择"FIx Project properties"
。
2.Now Clean
the project..I think this will help you..Let try for this and say..
2.现在Clean
这个项目..我想这会帮助你..让我们试试这个然后说..