[RK3399][Android7.1] Ubuntu 编译环境之Jdk版本切换

Platform: RK3399
OS: Android 7.1
PC: Ubuntu 14.04 LTS

默认是OpenJDK 7

kris@eco:~/Downloads$ java -version
java version “1.7.0_131”
OpenJDK Runtime Environment (IcedTea 2.6.9) (7u131-2.6.9-0ubuntu0.14.04.1)
OpenJDK 64-Bit Server VM (build 24.131-b00, mixed mode)

通过如下命令可以切换选择默认JDK版本

kris@eco:~/Downloads$ sudo update-alternatives –config java

[RK3399][Android7.1] Ubuntu 编译环境之Jdk版本切换_第1张图片

再看默认版本信息:

kris@eco:~/Downloads$ java -version
openjdk version “1.8.0_141”
OpenJDK Runtime Environment (build 1.8.0_141-8u141-b15-3~14.04-b15)
OpenJDK 64-Bit Server VM (build 25.141-b15, mixed mode)

相应的,javac的切换也是如此。

kris@eco:~/Downloads$ sudo update-alternatives –config javac


编译的时候可能会遇到如下错误:

Checking build tools versions...
************************************************************
You are attempting to build with the incorrect version
of javac.

Your version is: javac 1.7.0_111.
The required version is: "1.8"

Please follow the machine setup instructions at
    https://source.android.com/source/download.html
************************************************************
build/core/main.mk:272: *** stop.

通过前面的方法就可以解决问题。

参考
Establishing a Build Environment

你可能感兴趣的:(子类__Build,RK3399)