Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compile Android with JDK 1.7 - Android Development Tool

I have a source code which currently I use Java Compiler 1.6 to compile it, I want to use 1.7 version instead, I go to project properties and in Java Compiler section I change "Compiler Compliance" to 1.7, but when I build the project I get an error:

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

When I do its recommendation, It change the compiler to 1.6 again. I'm using Android Development Tool.

Thx

like image 674
Mazdak Avatar asked Sep 28 '13 16:09

Mazdak


People also ask

Do I need to install JDK for Android development?

Note: The JDK is installed if you do not have the recommended version of Java (1.6 or 1.7), regardless of whether the Android development tools are installed for you during product installation. Having the Android development tools installed on your development system is required for developing Android apps using RAD Studio.

Where is the Java JDK file for Android?

Java Development Kit (JDK): C:\Program Files\Java\jdk1.7.0_25 The first time you attempt to compile an Android application, RAD Studio prompts you to install the missing components of the Android SDK, Android NDK and Android development tools if some required components have not been installed during RAD Studio installation.

How do I install Android SDK build tools for Android 11?

In the SDK Platforms tab, select Android 11. In the SDK Tools tab, select Android SDK Build-Tools 30 (or higher). Click OK to begin install. Changing your app's build configuration to target Android 11 gives your app access to the Android 11 APIs and lets you fully test your app's compatibility as you prepare to add full support for Android 11.

What is SDK platform-tools?

Android SDK Platform-Tools is a component for the Android SDK. It includes tools that interface with the Android platform, such as adb, fastboot, and systrace.These tools are required for Android app development.


1 Answers

Android SDK does not support JDK 1.7 and thats the reason you are not allowed to use it for Compiler compliance. You need to use JDK 1.6 as mentioned under the System requirements here:

http://developer.android.com/sdk/index.html

UPDATE From Android Studio 0.3.2 onwards, there seems to be a support for Java 7 features: http://tools.android.com/recent/androidstudio032released

like image 152
Juned Ahsan Avatar answered Oct 22 '22 16:10

Juned Ahsan