Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can the Android SDK work with JDK 1.7?

Tags:

java

android

I just installed the Android SDK R16 and JDK 7, but I keep getting the error

Android requires compiler compliance level 5.0 or 6.0. Found '1.7' instead. Please use Android Tools > Fix Project Properties."

I am using some features of the JRE 1.7, so I can't just switch it to 1.6. How can I fix this problem?

like image 861
eBehbahani Avatar asked Dec 20 '11 16:12

eBehbahani


People also ask

What version of JDK does Android use?

A copy of the latest OpenJDK comes bundled with Android Studio 2.2 and higher, and this is the JDK version we recommend you use for your Android projects.

Is Android SDK same as JDK?

TLDR; SDK is a blanket term for any package of development tools for a language. ADK is a Java development kit but it's customized for Android-specific development. JDK is the Java Development Kit for developing Java applications.

Can I use Java 17 for Android Studio?

As per the docs, JDK 17 isn't supported yet in Android Studio. Actually, JDK 11 was supported starting from version 4.2 which was released in April 2021.

Does Android need JDK?

Since Android apps are written in Java, you will need the Oracle Java compiler and libraries on your system. These are collectively called the Java Development Kit or "JDK" for short. (If you are certain that you already have JDK 1.8 or higher on your computer, such as from taking CS 106A, you can skip to Step 2.)


1 Answers

Yes, you can use Java 1.7 for the Android development. You must keep source compatibility with Java 6 during compile and only the next problem is because of the changed default algorithm for jarsigner.

This is solved in Stack Overflow question Android signing with Ant (workaround).

But it is already fixed in Ant. So the official support will be directly in the Android SDK soon.

If you want to use Maven for the build, the solution is in What kind of pitfals exist for the Android APK signing.

Update: Latest version of Ant, Maven Plugin or Gradle has no problem with Java 7 or Java 8, so this is already obsolete.

like image 65
ATom Avatar answered Sep 20 '22 02:09

ATom