Jdk 7 requirement when building source

Hi everyone!

I’ve try to build Android source code follow this guide: http://docs.khadas.com/develop/BuildAndroid/
But i got an error with jdk version. I’m currently install jdk 8 and the require version is jdk 7. I could not install jdk 7 by script: sudo apt-get install openjdk-7-jdk.
Please give me a solution for this issue. Thank you!


you should run sudo apt-add-repository ppa:webupd8team/java
then run sudo apt-get update
after that run sudo apt-get install oracle-java7-installer (if you need oracle version)

to change java version you can run sudo update-java-alternatives -s java-7-oracle


1 Like


I’ve tried sudo apt-get install oracle-java7-installer
but jdk 7 have seem no longer existed. I’ve got error like below.
No one got issue which relate to jdk version when building android source code like me?

You can install OpenJDK-8

1) Add PPA

# sudo add-apt-repository ppa:openjdk-r/ppa

2) Update system package cache and install OpenJDK 8

# sudo apt-get update
# sudo apt-get install openjdk-8-jdk

3) If you have more than one Java versions installed on your system. Run below command set the default Java:

# sudo update-alternatives --config java

And set default Java Compiler by running:

# sudo update-alternatives --config javac

4) Finally check out current Java version by running:

terry@terry:~$ 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)

Have a try. Thanks.

4 posts were split to a new topic: There is something wrong with the compilation of android