[GUIDE][Ubuntu] Compiling Android from Source

Excellent write up! I have been dabbling about with the source myself since it was released. Building on Fedora 17 since I prefer that to Ubuntu (the process is largely the same).

Some of the permissions problems may come from running the extracting the binary drivers as root (you have "sudo sh script.sh" specified). I don't know of any reason you need to be root to extract the binaries. I extracted them as my user.

The part that I have been trying to find more info on is the Google apps stuff. I'd like to do as much myself as I can (I'm still a little unsure about installing some random zip that I cannot verify on my phone). Anyone have any information about how the gapps .zip files are made? I have managed to unpack the 4.1 factory image for the Nexus7 (the 4.1.1 images aren't up yet) and could copy gapps from that. I have looked at some gapps .zip files I have downloaded and there is a bit more than just the APKs. Anyone have any pointers about this?

Also, has anyone played with pulling in any of the Verizon stuff? Not sure what I might want. Definitely not Backup Assistant. MyVerizon can be useful, though.

The hardest part of this for me is finding the information I want/need. Someone knows it, it's just a matter of tracking it down. I want to do more than just download a zip that someone else has put together.

My apologies for not responding at length earlier, I was out and about :).

Here's the basics of a GAPPs package (if you haven't already broken one down):

  • A META-INF containing an install script
  • A system folder containing the apps and their associated files. The big thing to look for here is the apps are in system/app.

There may be other folders--I've seen an "optional" folder--but really what you need (like any flashable zip) is the stuff you want on your phone (the apps) and the way to get it there (the updater script).

What I do (and have done) is check out the latest GAPPs--say Jelly Belly's 7/14 package, and look and what's changed or how they do things, then I try to see how I can do that myself. I learn by analogy, so comparing two packages and figuring out how to make my own is the best method that I personally can utilize.

For "solid" GAPPs, I would recommend the above--Jelly Belly--as well as Bugless Beast if you want to incorporate them into the rom (which I dissuade, but may be easier for your own, personal use).

For GAPPs issues, the general issues were FC'ing and a few things not working. Off the top of my head, here are the issues I and "real" developers ran into:

  • Google Talk - force closes
  • Camera - doesn't work, Gallery force closes
  • Google Now - at first, it was missing a system/lib file as well as a language pack
  • Auto Restore (from market) - broken, except for BB and I believe Jelly Belly now

There were others, but those are the big ones off the top of my head. The AOSP release was fairly "buggy." Could that be attributed to some "error filled" builds? Possibly. I've read that most people think a build's not solid unless it's guaranteed to be so, and that guarantee comes with hardware that I and a lot of people don't have (16gb of ram at a minimum being one; also, the ideal '-j#' is -j16 and higher). But as of this moment, it appears that most devs have figured out how to fill the cracks, so I recommend seeing what they have done, give proper credit, and working it yourself :).

Hey, DM, great guide.

I'm currently running a Windows Machine (Win 7, 8Core i7 @2.8, 8GB RAM, 1.5TB HDD) and wanted to build JB really badly! Could I install Oracle VirtualBox and build Android by running Ubuntu on a Virtual Machine?

Secondly, I want to build it for a different device. The latest OS my device officially had was 2.2.3 but through our lovely devs we have 4.0.4 currently running quite smoothly. I want to build JB for it though I have no idea exactly how I would do it. I need to have my device (thunderc) be read or w/e for it to work, but I know very little about Linux. Any insight on my situation?

First off, thanks!

Yes, you can build on a VM machine. I believe the official AOSP link has a bit more about it; you look to have more than enough ram to handle it, so you should be fine.

For your other question, do you know if your device is supported by AOSP? If it is, then I suggest syncing with the master (remember, we have two options--master and a specific branch), then when you get to "lunch" use that and the series of commands after to select your device.

What you may have more success with is this path--do AOKP or CM build roms for your device? If they do, you can sync to their "gits" and you can build from them.
 
Starts Slow Clap..

Great guide and should help people get a better understanding as to what is really goes into building out a great rom..
 
  • Like
Reactions: dmmarck
Sadly, neither. My devices is actually ARMV6 X( and I can not afoord a decent upgrade, the only plausible one on VM would be the new sexy EVO, though I dont have 300 dollars at my disposal. TDM has built us AOSP, CM9, and AOKP through CM9 base code, but our device is not "officially' supported. We do not have official support from the Cyanogenmod or the Open Kang Project afaik. The only person building/maintaining for our device is @tdm and I think now @BobZhome does.

Thanks for the reply though. :D
 
Sadly, neither. My devices is actually ARMV6 X( and I can not afoord a decent upgrade, the only plausible one on VM would be the new sexy EVO, though I dont have 300 dollars at my disposal. TDM has built us AOSP, CM9, and AOKP through CM9 base code, but our device is not "officially' supported. We do not have official support from the Cyanogenmod or the Open Kang Project afaik. The only person building/maintaining for our device is @tdm and I think now @BobZhome does.

Thanks for the reply though. :D

Try seeing if they have a git and if they encourage folks to compile. I know some big devs do just that, like the aforementioned CM, AOKP, and even Pete Alfonso and Bugless Beast. Worth a shot!

Good luck :).
 
I think tdm has a github source, but it's ICS. I also beleive we're running a 2.6 kernel, not a 3.0 or above. How would an ICS Repo help me with JB exactly? So far I have managed to make a some-what themed CM9 ROM but I'd like to go past that is all.
 
I think tdm has a github source, but it's ICS. I also beleive we're running a 2.6 kernel, not a 3.0 or above. How would an ICS Repo help me with JB exactly? So far I have managed to make a some-what themed CM9 ROM but I'd like to go past that is all.

It wouldn't unfortunately. You're going to have to wait until a developer ports it over and then sets it up.

I mean you could try porting it over yourself, but that is way above my level of understanding and expertise :(.
 
I'm trying to build for my VZW gnex (toro), but it's not showing on my list after the lunch command anymore. It was there last night on my first build attempt (java issues). Went to give it another go, and it looks like it's been removed from AOSP. Anyone mind checking?

FYI: Maguro is still there
 
I'm trying to build for my VZW gnex (toro), but it's not showing on my list after the lunch command anymore. It was there last night on my first build attempt (java issues). Went to give it another go, and it looks like it's been removed from AOSP. Anyone mind checking?

FYI: Maguro is still there

Just put it in manually.

full_toro-userdebug

If it doesn't build, then I presume it was removed (but unlikely). Should build without a glitch; I have yet to seen it in the actual list though.
 
Thanks for this write up. I am having a problem getting started - here is the command I type and the error:


user@ubuntu:~$ sudo add-apt-repository "deb Index of / lucid partner"
user@ubuntu:~$ sudo apt-get update
E: Malformed line 62 in source list /etc/apt/sources.list (URI parse) >> this points to the line added above
E: The list of sources could not be read.

can anyone help me figure this out? tia
 
Hi, I'm new to the forums. However I'm not new to android. I'm impatiently waiting for Jelly Bean on my 2 week old Sprint Galaxy Nexus. Will this work for the Sprint version?
 
Hi, I'm new to the forums. However I'm not new to android. I'm impatiently waiting for Jelly Bean on my 2 week old Sprint Galaxy Nexus. Will this work for the Sprint version?

Nope, so far toroplus (Sprint) is not a supported AOSP device. Sorry :(.

Thanks for this write up. I am having a problem getting started - here is the command I type and the error:


user@ubuntu:~$ sudo add-apt-repository "deb Index of / lucid partner"
user@ubuntu:~$ sudo apt-get update
E: Malformed line 62 in source list /etc/apt/sources.list (URI parse) >> this points to the line added above
E: The list of sources could not be read.

can anyone help me figure this out? tia

Check the fixes post for some help with installing Java 6/JDK. I will also post another link in that shortly.
 
I'm following along, got the master since I also am on Ubuntu 12.04. After selecting full_toro-userdebug the script said

PLATFORM_VERSION=4.0.9.99.999.9999.99999

Does that mean the master is not Jelly Bean?
 
I'm following along, got the master since I also am on Ubuntu 12.04. After selecting full_toro-userdebug the script said

PLATFORM_VERSION=4.0.9.99.999.9999.99999

Does that mean the master is not Jelly Bean?

Quite possibly, although I had presumed that it would have been updated by now. I used the branch but I have seen that before.

FWIW, if the nine repeats infinitely it's the same as 4.1 lol

Sent from my Galaxy Nexus using Android Central Forums
 
Check this link if you're having java issues. Have you tried installing it again?

For whatever reason getting the JDK is the hardest part of this procedure. The open one should work, but right now the AOSP supplied method is...wonky.

Installing Java6 JDK on Ubuntu 12.04 | digital nomad

I'd suggest reinstalling it and seeing if that helps. You synced with source right, that went by smoothly?

I'll look up your specific issue a bit later, but unfortunately I don't have personal experience with that problem :(.

EDIT: check this link as well for troubleshooting/getting around Java 6/JDK issues!

ronubo TechStuff: Building AOSP with Ubuntu 12.04

Sent from my Galaxy Nexus using Xparent Cyan Tapatalk 2

This, from the second link you listed, resolved my make problems:
To work around it, you can just comment out the following lines in build/core/main.mk:

# ifneq ($(shell java -version 2>&1 | grep -i openjdk),)
# java_version :=
# endif


Thank you!
 
Thanks for the clearly written guide. I was able to do the build on Scientific Linux 6.2. I removed Icetea and installed the Java RPM from Oracle and I was good to go.

I have a question, how do I configure the Android kernel?. For standard Linux kernels you use make gconfig or make xconfig which bring up configuration GUIs for the kernel, that doesn't seem to work with the Android kernel, I also couldn't find the .config file that's used by a standard Linux kernel build. What's the Android equivalent?
 
Thanks for the clearly written guide. I was able to do the build on Scientific Linux 6.2. I removed Icetea and installed the Java RPM from Oracle and I was good to go.

I have a question, how do I configure the Android kernel?. For standard Linux kernels you use make gconfig or make xconfig which bring up configuration GUIs for the kernel, that doesn't seem to work with the Android kernel, I also couldn't find the .config file that's used by a standard Linux kernel build. What's the Android equivalent?

Configure how? On the device or building it? On the device you use an app like SetCPU or an equivalent.

If you mean building, that's my next big task. Check out the AOSP link in the credits, I believe there is some good info there to get you started.

Sent from my Galaxy Nexus using Android Central Forums
 
This, from the second link you listed, resolved my make problems:
To work around it, you can just comment out the following lines in build/core/main.mk:

# ifneq ($(shell java -version 2>&1 | grep -i openjdk),)
# java_version :=
# endif


Thank you!

Well now I am getting errors trying to build. I have selected toro, and I type "make -j2 otapackage", and I see the platform_version, etc., but under "checking build tools versions..." I get this error:

find: 'src': no such file or directory

I thought I had followed the directions and was successful at each one - anyone know what I'm doing wrong?
 
Well now I am getting errors trying to build. I have selected toro, and I type "make -j2 otapackage", and I see the platform_version, etc., but under "checking build tools versions..." I get this error:

find: 'src': no such file or directory

I thought I had followed the directions and was successful at each one - anyone know what I'm doing wrong?

Try looking at this:

http://code.google.com/p/android/issues/detail?id=21113

I would also check the stuff you downloaded for the build environment; I bet one of them had an error or was missing.

Sent from my Galaxy Nexus using Android Central Forums
 
  • Like
Reactions: dually