The video show how to set Java version on Studio 3.3.1.
By default, the Java language version used to compile your project is based on your project's compileSdkVersion (because different versions of Android support different versions of Java). If necessary, you can override this default Java version by adding the following CompileOptions {} block to your build.gradle file:
You can also set using Android Studio menu:
- File > Project Structure.
- In Structure Project dialog, Select App on the left, and select Properties tab.
- You can see option boxes of Source Compatibility and Target Compatibility).
sourceCompatibility vs targetCompatibility
According to Gradle documentation:
JavaVersion sourceCompatibility - Java version compatibility to use when compiling Java source. Default value: version of the current JVM in use JavaVersion. Can also set using a String or a Number, e.g. '1.5' or 1.5.
JavaVersion targetCompatibility - Java version to generate classes for. Default value: sourceCompatibility. Can also set using a String or Number, e.g. '1.5' or 1.5.
JetBrains Toolbox App is a lightweight cross-platform companion application for JetBrains' coding tools, to manage installed tools, download new ones and open recent projects.
System requirement to install Toolbox App for Linux:
64-bit x86, glibc 2.17 (Ubuntu 14.04 or newer). JetBrains Toolbox App is packaged in AppImage and requires FUSE to run.
To check the version of your glibc, it's a simple method, using ldd command in Terminal: $ ldd --version
It will show something like this:
ldd (Ubuntu GLIBC 2.27-3ubuntu1) 2.27
To install and set FUSE, follow the steps in AppImage Wiki.
OpenJDK (https://openjdk.java.net/) provides open-source builds of the Java Development Kit, an implementation of the Java SE Platform under the GNU General Public License, version 2, with the Classpath Exception.
Commercial builds of JDK from Oracle under a non-open-source license, for a wider range of platforms, can be found at the Oracle Technology Network.
This video show how to Install OpenJDK 11.0.2 on Linux Mint 19.1. The OpenJDK will be stored in /opt/java directory, and set as default. It should be work on other Ubuntu variants also.
Oracle's OpenJDK JDK binaries for Windows, macOS, and Linux are available on release-specific pages of jdk.java.net as .tar.gz or .zip archives.
As an example, the archives for JDK 11 (currently 11.0.2) may be found on https://jdk.java.net/11/.
The Data Binding Library is a support library that allows you to bind UI components in your layouts to data sources in your app using a declarative format rather than programmatically. It's my first exercise of using Data Binding and ObservableField, in Java. Basically, it follow the steps in Android Developers document of Data Binding Library.
The TextViews myArchitecture, myRelease and myDensity are loaded in onCreate() once. The TextView myNumber is associated with ObservableField, and will be updated at run-time.
Prepare:
- To use the Data Binding Library in your app, you have to target devices running Android 4.0 (API level 14) or higher.
- It's recommended to use the latest Android Plugin for Gradle in your project. Currently it's 3.3.1.
Read this video how to:
- Make sure include Support Repository in the Android SDK manager.
- Add the dataBinding element to your build.gradle file in the app module.
In Android Studio, select Project view, extend app view, select to edit build.gradle. Add the code: