Android Console Error: “requires .class compatibil

2019-06-20 13:02发布

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?

6条回答
贪生不怕死
2楼-- · 2019-06-20 13:27

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

查看更多
祖国的老花朵
3楼-- · 2019-06-20 13:27

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

查看更多
一纸荒年 Trace。
4楼-- · 2019-06-20 13:28

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

查看更多
对你真心纯属浪费
5楼-- · 2019-06-20 13:33

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.

查看更多
Evening l夕情丶
6楼-- · 2019-06-20 13:38

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.

查看更多
forever°为你锁心
7楼-- · 2019-06-20 13:42

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.

查看更多
登录 后发表回答