Question

I've been trying all day to compile the Android source code on my Ubuntu 12.04 64bit OS.

For some reason, I'm stuck on the phase of having the Sun/Oracle JDK 1.6 version installed. I've been trying many commands (and the official link of course) and I end up either having nothing, having JDK 1.7 or OpenJDK, or not having the jdk-tools.

What are the exact steps to successfully compile the code (or part of it) using JDK? I'm stuck at the phase of "make j4" on this link.

Was it helpful?

Solution

installing the proper java version(1.6) for android do the below

1) Installing JDK

Since Sun JDK is no longer in Ubuntu’s main package repository, we have to manually install it in ubuntu 12.04 from oracle website

Please go the below link and download the JDK

http://www.oracle.com/technetwork/java/javase/downloads/jdk6-downloads-1637591.html

Follow the below steps to install the java and configuring it for the usage

$ chmod +x jdk-6u33-linux-x64.bin

$ sudo ./jdk-6u33-linux-x64.bin
$ sudo mv jdk1.6.0_33 /usr/lib/jvm/

$ sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.6.0_33/bin/java 1
$ sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.6.0_33/bin/javac 1
$ sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.6.0_33/bin/javaws 1

$ sudo update-alternatives --config java
$ sudo update-alternatives --config javac
$ sudo update-alternatives --config javaws

To verify the isntallation is proper do the belwo steps. It should now show that the Sun JDK is running instead of IcedTea

$ java -version

java version "1.6.0_33"

Java(TM) SE Runtime Environment (build 1.6.0_33-b04)

Java HotSpot(TM) 64-Bit Server VM (build 20.8-b03, mixed mode)

For compiling android on ubuntu 12.04 and installing the proper java version visit http://www.embeddedcircle.com/android-compilation-in-ubuntu-12-04-lts-precise-for-pandaboard/

thanks dino

OTHER TIPS

In Ubuntu, when you download the jdk (32-bit version if it is for android programming, and in my opinion better the tar.gz than the .rpm one) it is important to 'install' and also to export using the commands you can see in the page of Oracle if I'm not wrong. You also need to go to your editor (Eclipse, Netbeans or which one?) and add the new Java platform to make sure you are using the version of the JDK you want to.To export means that you can compile the project when you want to.If not,you have to go to the java directory and inside the /bin folder do the command (probably with sudo at the beginning) to compile your project.

P.S.: You can find how to export here

I got this same problem. Some people reporting even JDK SE will see errors. Another work-around is modifying two lines of source code, see here:

Diff changes

https://github.com/CyanogenMod/android_external_guava/commit/c8b97210aa31c9b80b5fd136d8617ebe4e731e09

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top