Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android build error due to incorrect java version

I am currently trying to build Android just for learning purpose. But I am facing strange error -

You are attempting to build with the incorrect version of java. Your version is: java version "1.7.0_07". The correct version is: Java SE 1.6.

my java - version gives me

java version "1.7.0_07" Java(TM) SE Runtime Environment (build 1.7.0_07-b10) Java HotSpot(TM) 64-Bit Server VM (build 23.3-b01, mixed mode)

any Idea what went wrong? regards,

like image 720
fadedreamz Avatar asked Oct 22 '12 16:10

fadedreamz


2 Answers

1.) If you’ve already installed OpenJDK . Remove it by running this command: sudo apt-get purge openjdk*

2.) Then:

sudo add-apt-repository ppa:webupd8team/java

Then update:

sudo apt-get update

3.) Select which version you want To install Oracle Java 8:

sudo apt-get install oracle-java8-installer

To install Oracle Java 7:

sudo apt-get install oracle-java7-installer

To install the Java 6:

sudo apt-get install oracle-java6-installer
like image 84
Swapnil Kale Avatar answered Oct 17 '22 02:10

Swapnil Kale


After upgrade Ubuntu 12.04 to 12.10 - just export path before build Android e.g:

export PATH=/usr/lib/jvm/java-6-openjdk-amd64/bin/:$PATH

like image 20
user1770626 Avatar answered Oct 17 '22 01:10

user1770626