Your project contains error(s), please fix it before running it

前端 未结 26 2513
暖寄归人
暖寄归人 2020-12-04 05:31

I am developing a simple Android application. But when I run Eclipse, it shows the following error:

Your project contains error(s), please fix it befo

相关标签:
26条回答
  • 2020-12-04 06:03

    Yes, this is a rather cryptic message. If you've got a faulty project (say one you've been working on in the past) then you'll get this message (and no messages in your current project's Problems / Error Log panes).

    You may just want to run your current project. This may be perfectly fine. Just click on the down arrow to the right of the Run button to select your project.

    0 讨论(0)
  • 2020-12-04 06:04

    I had this exact problem when trying to run the Doodlz app, from the book Android for Programmers, on Mac OS X with Eclipse Juno.

    After downloading and unzipping the demos from the book, I forgot to change the permission of the files. They were read-only on my system so this was the first issue.

    The second issue was solved by selecting a build target on Eclipse. This was fixed by going to: Project > Properties , and clicking the Android field on the left panel to be able to select one option as the Project Build Target, which in my case was:

      Target Name     Vendor         Platform    API Level
    > Google APIs     Google Inc.    4.0.3       15
    

    Then cleaning and rebuilding the project showed no errors.

    Finally, to run the app right-click the package (at the Package Explorer tab) and then select: Run As > Android Application

    0 讨论(0)
  • 2020-12-04 06:05

    I have had a similar problem.

    Under "problems" tab I have found an error saying "Error generating final archive: Debug Certificate expired on 2/22/12 1:49 PM"

    So my advice is to look in the problems tab to get some more info.

    Bye

    0 讨论(0)
  • 2020-12-04 06:05

    I had the same error, when I copied a project to another computer.

    I then checked all properties of the project on both machines, and the only thing that was different was the order of items in Java Build Path - tab Order and Export.

    I moved the items Android X.X.X and Android Dependencies above the other 2 in the list (in my case, src and gen folders) and voila, it worked again!

    I'm not really sure if the different order was actually the problem, but at least changing it (and saving the properties again) seemed to help...

    0 讨论(0)
  • 2020-12-04 06:06

    That usually comes from errors in the build path.

    If you're using eclipse, there is a view you can add that lists all the errors called "Problems":

    enter image description here

    Otherwise, you can try to clean the project, and that usually solves a few problems.

    Finally, if you add or alter resources from outside your IDE, you'll want to reload the resources and clean.

    EDIT (Comment by anonymous user)

    This can also be caused by an out of date "Debug Certificate" fixed as follows:

    IF ALL FAILS THEN THIS GOTTA BE THE SOLUTION:

    Delete your debug certificate under ~/.android/debug.keystore (on Linux and Mac OS X); the directory is something like %USERPROFILE%/.androidon Windows.

    The Eclipse plugin should then generate a new certificate when you next try to build a debug package. You may need to clean and then build to generate the certificate.

    This is also another fix for the "setContentView(R.layout.main);" error that says it cannot find R.layout.main when it is actually generated. (R cannot be resolved to a variable).

    This is also another fix for the error "Your project has errors..." and you cannot find any. Clean and rebuild are still necessary after generating a new debug certificate.

    0 讨论(0)
  • 2020-12-04 06:08

    For some reason eclipse only showed a ! error on root and didn't specified what error it was. Go in Windows -> Show Views -> Problems. You might find all previous errors there, delete them, do a clean build and build again. You'll see the exact errors.

    Eclipse shows an error on android project but can find the error

    0 讨论(0)
提交回复
热议问题