aeroxr1
aeroxr1

Reputation: 1074

JDK 7 and Android IDE

I have jdk 6 and 7 installed on my PC.

On this link https://developer.android.com/sdk/index.html#ExistingIDE , I read that Android IDE is compatible with jdk 6, but I want to know if Android SDK works also with jdk 7 or if there are problems ?

If there are problems can I mantain the jdk 7 and configure Android sdk to use Jdk 6 ?

Upvotes: 1

Views: 2986

Answers (4)

David Ruiz
David Ruiz

Reputation: 29

I noticed the same problem today http://developer.android.com/sdk/installing/installing-adt.html where the recommended jdk is 1.6 but according to the main bundle Android has full support for 1.7 http://developer.android.com/sdk/installing/index.html?pkg=studio.

So I woudl say...Yes! 8 )

Upvotes: 0

Ahmed Faisal
Ahmed Faisal

Reputation: 4427

Yes, you can use Java 1.7 for the android development.

Starting from build tools 19, Android has full support for Java 1.7. So you can set 1.7 as source and target for compilation. Support for this is from Android studio 0.3.2. Android kitkat has full support of JAVA 1.7 API, but most of language features from 1.7, can be used on the older android versions too.

Edit: You can also mantain the jdk 7 and configure the Android application to use Jdk 6 during compilation.

Upvotes: 1

matiash
matiash

Reputation: 55380

It's not even necessary to have JDK 6 installed. You can just configure Eclipse to "compile as JDK 6" and it will work.

To change for the whole workspace, enter Window -> Preferences, then Java -> Compiler and set Compiler compliance level to 1.6.

You can also do this in individual projects, if you prefer, in Project -> Properties -> Java Compiler.

Upvotes: 0

Bryan Herbst
Bryan Herbst

Reputation: 67259

You can build a project using JDK 7 in Eclipse with the ADT plugin with no extra configuration and with any version of the ADT plugin, so long as you only use features in JDK 6.

Support for Java 7 language features was added to the Eclipse ADT plugin in March 2014 (ADT 22.6.0 and up). All you need to do is update your application project settings to use JDK 7 and ensure that Eclipse is running on JDK 7 as well.

Note that unless your minSdkVersion is 19+ (KitKat), you cannot use try-with-resources.

From the ADT plugin tools page:

ADT 22.6.0 (March 2014)

General Notes:

  • Added support for Java 7 language features like multi-catch, try-with-resources, and the diamond operator. These features require version 19 or higher of the Build Tools. Try-with-resources requires minSdkVersion 19; the rest of the new language features require minSdkVersion 8 or higher.

    To use the new language features after installing ADT 22.6.0, ensure that you run Eclipse on JDK 7 and change your application project settings to use JDK 7.

Upvotes: 2

Related Questions