Can not compile enums in Eclipse

后端 未结 3 630
醉话见心
醉话见心 2020-12-03 13:45

While trying to introduce enums in my Android project in Eclipse, I encountered with the following problem: Compiler says:

  1. The type java.lang.Enum cannot be re
相关标签:
3条回答
  • 2020-12-03 14:24

    Close project the project with the error.

    Open a different project and launch in emulator. Close the alternative project.

    Open the original project with the error which should no longer be evidenced.

    Don't know why it works or if actually launching the app is necessary but it clears the error .

    0 讨论(0)
  • 2020-12-03 14:34
    1. Go to properties of project with the build error (right click > Properties)
    2. View the "Libraries" tab in the "Build Path" section
    3. Find the "JRE System Library" in the list (if this is missing then this error message is not an eclipse bug but a mis-configured project)
    4. Remove the "JRE System Library"
    5. Hit "Add Library ...", Select "JRE System Library" and add the appropriate JRE for the project (eg. 'Workspace default JRE')
    6. Hit "Finish" in the library selection and "OK" in the project properties and then wait for the re-build of the project

    Hopefully the error will be resolved ...

    0 讨论(0)
  • 2020-12-03 14:47

    Open the properties for the project, select the page "Java Compiler" and set the "Compiler Compliance level" to "1.5" or better.

    Project properties page for the Java Compiler

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