FORUMS
Remove All Ads from XDA

[ GUIDE ] How to Setup Ubuntu 13.10 Saucy Salamander to Compile Android ROMs

281 posts
Thanks Meter: 1,850
 
Post Reply Email Thread

Initializing a fresh Android Build Environment in Ubuntu 13.10 sucks, right? The instructions at the AOSP page are outdated and inaccurate. Near as I can tell, they try to have you install 2 JDKs, the first one not even being the correct link for Saucy Salamander, and the second being OpenJDK. Which might work. But I dunno about all that, I'd rather have Oracle's official stamp when it comes to building for Android.

Currently most of the guides are up to 12.04 LTS, which is fine and dandy, but being on the cutting edge is nice too.

This guide applies to all variations of Ubuntu 13.10 Saucy Salamander 64 bit. Do not use the 32 Bit version. Also, PAY CLOSE ATTENTION when to use "sudo" and when to not. It can make things funky if you do something as root that you shouldn't.

Much thanks goes out to Google, ProTekk, Canonical, and everyone else that I read a random paragraph here and snippet there.

First, let's set up the correct JDK.

Many of you probably have some kind of wrong Java installed unless you're starting with a fresh Ubuntu base, and even then maybe.

Let's get rid of that. Copy and paste this into a Terminal window:

Code:
sudo apt-get purge openjdk-\* icedtea-\* icedtea6-\*
Follow the instructions to remove OpenJDK. If you must keep it, it's possible. But I'm not going to tell you how to do it here. I don't want any chance of confusion or mistake.

Now copy and paste the following into the Terminal:

Code:
sudo add-apt-repository ppa:webupd8team/java
This will add the correct PPA to your system for updated builds of Java 6 JDK that are compatible with 13.10. No more unrecognized Java version errors! And it will update automatically with the rest of your system.

Next, we actually need to install the package. More copy-paste:

Code:
sudo apt-get update && sudo apt-get install oracle-java6-installer
Follow the on-screen instructions. You have to Accept the Licensing Agreement to complete the install. Hopefully no human centipede clauses.

Let's make sure the correct version of Java is activated, run the following Terminal command:

Code:
java -version
You should see something like the following:

Code:
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.12-b01, mixed mode)
Ok, back to a fresh Terminal prompt. Time for installing the guts to build stuff in Ubuntu:

Code:
sudo apt-get install git-core lzop ccache gnupg flex bison gperf build-essential zip curl zlib1g-dev zlib1g-dev:i386 libc6-dev lib32ncurses5 lib32z1 lib32bz2-1.0 lib32ncurses5-dev x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 lib32z-dev libgl1-mesa-glx:i386 libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown libxml2-utils xsltproc readline-common libreadline6-dev libreadline6 lib32readline-gplv2-dev libncurses5-dev lib32readline5 lib32readline6 libreadline-dev libreadline6-dev:i386 libreadline6:i386 bzip2 libbz2-dev libbz2-1.0 libghc-bzlib-dev lib32bz2-dev libsdl1.2-dev libesd0-dev squashfs-tools pngcrush schedtool libwxgtk2.8-dev python gcc g++ cpp gcc-4.8 g++-4.8
When that is done installing, run the following command in your Terminal window:

Code:
sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
That's it on the package side of things.

You guessed it, time for more Terminal. This really is the easiest way, seriously. And it's totally worth it when you're basking in the glory of a bunch of people on XDA.

The binary for a program called "repo" will let you talk to git servers and download all that precious source code. That second part after the && allows it to be executable:

Code:
mkdir ~/bin && curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo && chmod a+x ~/bin/repo
Use your favorite text editor to open ~/.bashrc

I like nano:

Code:
sudo nano ~/.bashrc
At the very bottom, add the following line:

Code:
export PATH=~/bin:$PATH
Save it. In nano that would be Ctrl-O and then Enter. Then Ctrl-X to exit back to a prompt. Restart bash:

Code:
source ~/.bashrc
In the terminal, navigate to where you would like to store the Android source code. The directions below will make it in your home folder, but if you have limited space, you may want to create it somewhere else. Faster is better, i.e. SSD would be best, USB external is basically unusable. Here we go:

Code:
mkdir ~/android
cd ~/android
Now you're going to initialize the repo. Here's where you decide the flavor of Android you want to build for, ie AOKP, CyanogenMod, AOSP etc. The following, for the purposes of this tutorial, will initialize for AOKP Jellybean MR-2:

Code:
repo init -u git://github.com/AOKP/platform_manifest.git -b jb-mr2
Almost there. Last step, but it's a doozy. You're going to get the source. Prepare yourself, mere mortal. 10+ GB of downloading await you. Don't worry, it's automated. Go to sleep. Eat something. Perhaps you have heard of this new thing the kids are doing called "going outside"? Yeah, I didn't think so. Me neither. The final terminal command, to be run from your android directory:

Code:
repo sync
Check back periodically every hour or so. It really all depends on how fast your internet connection is.

That should be everything. Now you're ready to build Android the right way. Luck!

Feel free to buy me a coconut water (donate) if you like my work. It would be greatly appreciated!

Please hit the "Thanks" button if this post helped you out!
The Following 145 Users Say Thank You to sylentprofet For This Useful Post: [ View ] Gift sylentprofet Ad-Free
 
 
18th October 2013, 12:04 AM |#2  
metalspring's Avatar
Senior Member
Thanks Meter: 4,342
 
Donate to Me
More
Thanks for this... It should work on the official final release right?
I tried using a guide for Ubuntu 13.04 and it can't install one of the packages listed and repo init fails...hopefully this will work
Also, anyone know what the repo init command to build PAC rom is?

Sent from my Galaxy Nexus using Tapatalk
The Following User Says Thank You to metalspring For This Useful Post: [ View ] Gift metalspring Ad-Free
18th October 2013, 05:02 AM |#3  
metalspring's Avatar
Senior Member
Thanks Meter: 4,342
 
Donate to Me
More
hmm...all good except repo doesnt seem to work with
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
but it does with
curl http://commondatastorage.googleapis....downloads/repo > ~/bin/repo
from http://source.android.com/source/downloading.html
The Following 4 Users Say Thank You to metalspring For This Useful Post: [ View ] Gift metalspring Ad-Free
20th October 2013, 04:21 PM |#4  
Kevinjoa's Avatar
Recognized Developer / Recognized Contributor
Flag Luedenscheid
Thanks Meter: 2,844
 
Donate to Me
More
I am getting this error:

kevin@kevin-GA-870A-UD3:~/cm10.1$ repo init -u git://github.com/CyanogenMod/android.git -b cm-10.1
/home/kevin/bin/repo: Zeile 1: Syntaxfehler beim unerwarteten Wort »newline«
/home/kevin/bin/repo: Zeile 1: `<!DOCTYPE html>'

---------- Post added at 05:21 PM ---------- Previous post was at 05:14 PM ----------

Edit: Fixed it myself.
20th October 2013, 08:38 PM |#5  
Junior Member
Flag Vienna
Thanks Meter: 0
 
More
Quote:
Originally Posted by Kevinjoa

I am getting this error:

kevin@kevin-GA-870A-UD3:~/cm10.1$ repo init -u git://github.com/CyanogenMod/android.git -b cm-10.1
/home/kevin/bin/repo: Zeile 1: Syntaxfehler beim unerwarteten Wort »newline«
/home/kevin/bin/repo: Zeile 1: `<!DOCTYPE html>'

---------- Post added at 05:21 PM ---------- Previous post was at 05:14 PM ----------

Edit: Fixed it myself.

How do you fixed it? I am getting the same Error here.
20th October 2013, 09:17 PM |#6  
misterjaytee's Avatar
Junior Member
Thanks Meter: 10
 
More
Quote:
Originally Posted by chrisi92

How do you fixed it? I am getting the same Error here.

metalspring posted the fix above (as did I in another thread yesterday):
Code:
$ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
The Following User Says Thank You to misterjaytee For This Useful Post: [ View ] Gift misterjaytee Ad-Free
20th October 2013, 09:19 PM |#7  
Junior Member
Flag Vienna
Thanks Meter: 0
 
More
Oh sry, i didnt saw it. But thx for the solution

Gesendet von meinem SM-N9005 mit Tapatalk
20th October 2013, 09:28 PM |#8  
misterjaytee's Avatar
Junior Member
Thanks Meter: 10
 
More
Quote:
Originally Posted by chrisi92

Oh sry, i didnt saw it. But thx for the solution

No problems - good luck with the build.
21st October 2013, 12:21 AM |#9  
twrex82's Avatar
Member
Flag Indialantic
Thanks Meter: 25
 
More
This is awesome. I was having this same problem and now I will have it fixed. Thanks so much.

Sent from my SPH-D710 using Xparent Skyblue Tapatalk 2
21st October 2013, 12:29 PM |#10  
Akhil's Avatar
Senior Member
Flag 21.14°N 81.38°E
Thanks Meter: 990
 
Donate to Me
More
Thumbs up
Excellent guide...
Read several guides and got stuck in every guide..
Thank you for this great guide...!!!!
21st October 2013, 04:54 PM |#11  
twrex82's Avatar
Member
Flag Indialantic
Thanks Meter: 25
 
More
if i wanted to build specific for e4gt(d710) i would replace mr2 with d710?
(repo init -u git://github.com/AOKP/platform_manifest.git -b jb-d710)
Post Reply Subscribe to Thread

Tags
13.10, android, compile, rom, ubuntu

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes