您的位置:首页 > 编程语言 > Java开发

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

2017-11-29 15:07 686 查看
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



再看默认版本信息:

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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: