I always get confused about this, what SDK version of Java does Android run on?
For example Android 2.3 and Android 4.0. What JAVA SDK they run (1.4,1.5..etc?
Please let me know unless I am missing the concept completely
I always get confused about this, what SDK version of Java does Android run on?
Technically, it runs on no "SDK version of Java". Android devices have the Dalvik VM for executing Dalvik bytecode, not a Java VM for executing Java bytecode.
The Android development tools will cross-compile Java bytecode into Dalvik bytecode when you build your Android app. Those tools support Java bytecode from Java 1.5 or 1.6. It definitely does not support older than 1.5, and I am not certain what all happens if you try Java 7.
Currently, java 1.6 is the version used for all Android versions. Keep in mind there are some things not present, and some extras added, so really, it's more like its own branch.
Related
I have looked at this page but I don't understand why I have to install the Java Development Kit (JDK), when it doesn't appear to be used in the tutorial.
Can someone please explain this?
Because you need JDK to develop android application. Usually this was bundled with android studio so you don't need to install JDK. And also basically, Android at its core is java.
JDK - Java Development Kit
It is required as it consists of JVM - Java Virtual Machine. It is also needed as it converts your class to bytecode. It is the base of Application Proramming related to Android.
Android Studio 3.2 Canary 5
Build #AI-173.4630681, built on March 3, 2018
JRE: 1.8.0_152-release-1136-b01 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 4.15.4-300.fc27.x86_64
I have just started a new project and when I sync'd I got this dialog box.
I am just wondering what is the difference between the Android Gradle Project and Gradle.
How would I upgrade to Gradle to version 4.5?
What is the purpose of both of these?
Many thanks in advance
Gradle is the build system.
You can use it with a lot of plugins. One of these is the Android Gradle plugin.
It is used to provide processes and configurable settings that are specific to building and testing Android applications.
Even if you have written the same java source code for a java project and android project, the way they are built and executed completely differs from each other.
Java project sources compiles to byte codes (.class files) and runs on JVM (java virtual machine).
Android project sources compiles to Dalvik byte codes (.dex files) and runs on DVM (Dalvik Virtual Machine). And both of these virtual machine have different ways of executing commands.
Android projects have many platform specific steps when building application that standard Java applications does not have. (like packaging as apk, automatic signing, project flavors management, minimum API level) With the addition of Android Gradle plugin these differences can be applied more easily and in a more refined way. (So building Android apps becomes easier for everyone).
The Android Studio build system is based on Gradle, and the Android plugin for Gradle adds several features that are specific to building Android apps. Although the Android plugin is typically updated in lock-step with Android Studio, the plugin (and the rest of the Gradle system) can run independent of Android Studio and be updated separately.
From the Docs
https://developer.android.com/studio/releases/gradle-plugin.html
My recent Android Studio 2.2 preview 3 installation can't seem to find CMake.
I tried installing it from the SDK Tools but there's no such package...
We won't be able to support CMake (or ndk-build) on 32 bit OS because it is not supported in CLion which is the tech we use for the C++ editor. The root cause is memory\address-space limits.
Here's a helper page where I describe Android Studio C++ support including the 64 bit requirement: https://sites.google.com/a/android.com/tools/tech-docs/external-c-builds
I hope this helps!
- Jomo
I am using JDK8x64 (only) with Android Studio 2.1 and targeting Android 4+.
Here I think this JDK8x64 used for build system itself, not for exporting to Android. (So it is OK, because Java 8 is backward compatible). (OS: Win7x64)
But according to: https://forums.xamarin.com/discussion/48581/use-of-jdk-8-with-xamarin-android
Is it true that Building with JDK8 makes the app not works on older Android OS versions?
Any experience?
And what about JDK 8 with Xamarin Android?
You can use JDK 8 and the compiler will only use the features of Java that are available (you will not be able to use the latest features introduced in JDK 8 such as lambdas, otherwise you will get an error).
However, if you target Android N, you will be able to use OpenJDK 8's features, some of which are backward compatible with previous versions of Android (e.g. lambdas and method references are backwards compatible). To see what's available, check here:
Supported Java 8 Language Features and APIs
We been using v8 since it was released and have not had any problems within Xamarin.Android apps (or Java binding libraries):
>javac -version
javac 1.8.0_92
>java -version
java version "1.8.0_92"
Java(TM) SE Runtime Environment (build 1.8.0_92-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.92-b14, mixed mode)
That said, Xamarin website does state:
OS-X Requirements
Xamarin.Android requires the following for use with Xamarin Studio on a Mac:
Java JDK 7 (1.7)
If you are developing solely for Android versions older than Android 5.0 Lollipop (API 21), Java JDK 6 (1.6) can still be used. Later versions of the JDK can also be installed to run alongside JDK 6 or JDK 7 if required by your machine.
Windows Requirements:
Xamarin.Android also requires that a 32-bit Java JDK 7 (1.7) be installed.
Later versions of the JDK can also be installed alongside JDK 7, if required by your machine.
To answer your question, yes this is true. But Android Studio tends to handle this for you, as stated by #tyczj. Lets say for example you are building an app from JDK8 for your Android 4+, but I want to run that same app on my Android 2.3, which I still have. It might not work due to compatibility issues. Although Android Studio takes care of this by allowing you to specify which version(s) you would like to support, it wouldn't hurt to look at differences between JDK8 and say, JDK6.
I'm installing it using this guide here which asks me to install Java 6, but Oracle no longer allows you to download the version I'm supposed to get. Is it possible for me to just use Java 7, or will things begin to fail?
http://forum.xda-developers.com/showthread.php?t=2302780
Are you confusing the Java Runtime Engine (JRE) with the Java SDK? I can download Java 1.6 from the official source here.
You can also use Java 1.7 with Eclipse or Android Studio, so I'm pretty sure you accidentally went to the JRE download page. JRE and Java SDK ain't the same at all.