Jessie
Jessie

Reputation: 141

The compiler compliance specified is 1.6 but a JRE 1.8 is used

My eclipse reported the warning that "The compiler compliance specified is 1.6 but a JRE 1.8 is used".

I have built my HelloWorld Android application using Java1.8, however, I got that warning and I cannot build up my project. I have tried to set the compiler compliance to java1.8. But I got another error that

"Android requires compiler compliance level 5.0 or 6.0. Found '1.8'"

.I don't know how to fix this problem?

Upvotes: 14

Views: 92672

Answers (4)

sedub01
sedub01

Reputation: 93

I'm working on VSCode and I just made next thing I changed version in pom.xml to one I installed on computer.

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>1.11</maven.compiler.source>
    <maven.compiler.target>1.11</maven.compiler.target>
    <java.version>1.11</java.version>
</properties>

Before I had 1.8 and now there is 1.11.

Upvotes: 3

S Satyen
S Satyen

Reputation: 51

Following changes need to be done under folder name of your project: -

.settings

eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.methodParameters=generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
org.eclipse.jdt.core.compiler.processAnnotations=disabled
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.8

IDE configuration

Upvotes: 0

Swapnilk
Swapnilk

Reputation: 1

Go to windows>preference>java>compiler. Tick the check box "use default compliance setting" then apply and close. Right-click on the project and go to build path> configure build the path Under Libraries tab remove JRE System Library and click on add library select the radio box execution environment and select the environment Apply nad Close

Upvotes: 0

Romil Patel
Romil Patel

Reputation: 13747

Possible solution:

  1. Right-click on your project and select "Android Tools -> Fix Project Properties". (if this doesn't work, try the following option)
  2. Right-click on your project and select "Properties -> Java Compiler", check "Enable project specific settings" and select 1.5 or 1.6 from the "Compiler compliance settings" select box.
  3. Under Window -> Preferences -> Java -> Compiler, set Compiler compliance level to 1.5 or 1.6.

Upvotes: 20

Related Questions