Android Console Error: “requires .class compatibility set to 5.0. Please fix project properties”

▼魔方 西西 提交于 2019-12-10 14:49:30

问题


Just did a fresh Install of Eclipse 3.5 and the Android Platform (SDK's and ADT). I've done this a few times on different machines and so I'm pretty sure I've got everything configured properly.

Tried importing an Android project and received the following error in the console window:

"Android requires .class compatibility set to 5.0. Please fix project properties."

I've never seen this error before. The only thing I can think of is that its talking about the build target? I've got the project build target set to 1.6 (API Level 4), Which is where I want it. Seems silly that they would require me to change to a higher API level...

Anyone else see this error before?


回答1:


I believe that Android is talking about the Java bytecode format, which you can set in "Window/Preferences", "Java/Compiler/Compiler Compliance Level".




回答2:


I had to Rebuild all my Projects when I imported from my Windows machine to the Mac. Project => Build Project did the trick.




回答3:


Just clean the imported project for Project->clean and selecting the project just imported. it Worked for me. hope would work for you too. :)




回答4:


I got a new Windows 7 notebook and also had to set compiler comliance level to 1.5. On my former Vista workstation and on my MacBook Pro I never ran into that issue.




回答5:


I resolved it by doing :

  • Clic on your project
  • Delete (Don't check "Delete project content on disk")

Clic on :

  • Window
  • Preferences
  • Java
  • Compiler
  • Check "Use Default compliance settings"
  • Apply
  • ok

At that point JDT's compiler preferences get properly set to 1.6

  • Import your project from your workspace

The error is gone.




回答6:


Using Eclipse and compiling an Android app after upgrading to JDK1.7+?

Try this...

Right-click on the project name in the package explorer.

Select Java Compiler.

Check off enable project specific settings.

Select Compiler compliance level 1.6

Apply/OK.



来源:https://stackoverflow.com/questions/4139168/android-console-error-requires-class-compatibility-set-to-5-0-please-fix-pro

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!