[GUIDE][Ubuntu] Compiling Android from Source

Thank You for great tutorial!
however i do have one question. i followed all the tutorial, built source code. if i would edit any source code file (e.g add simple log message in any function), will i have to fully rebuild it? or is it possible to build individual components faster?
 
Yes there is a way to built just a particular system app. However its been a long time for me since I've built from source and I can't remember the exact command to enter to build a particular app.

It can be done, I would search around the Google developer pages for the exact code but I did do it myself in the past rebuilding just the Settings.apk for example...
 
Yes there is a way to built just a particular system app. However its been a long time for me since I've built from source and I can't remember the exact command to enter to build a particular app.

It can be done, I would search around the Google developer pages for the exact code but I did do it myself in the past rebuilding just the Settings.apk for example...

Thank You in advice.
In the meantime ill try to search for it too.
 
Thank You for great tutorial!
however i do have one question. i followed all the tutorial, built source code. if i would edit any source code file (e.g add simple log message in any function), will i have to fully rebuild it? or is it possible to build individual components faster?

Yes, you have to read about git and repo.

For example, I have played alot with the DeskClock App and built it separately many times. So what you do is modify the code in that project (the desk clock itself is a git repository... i.e. if you locate it's containing folder, you'll see a ".git" folder... that's the repository local repository that will contain the original code. Then you can build it. You can build anything separately that has a '.git' folder, I believe

Here are the steps how I build the desk clock by itself:
1. edit your source code to your hearts desire, say DeskClock
2. source build/envsetup.sh (just like building source)
3. lunch full_toro-userdebug (maybe an optional step, but probably depends on what you are building, and what device you want to use it on)
4. time mmm -j9 ~/WORKING_DIRECTORY/packages/apps/DeskClock

of course, you might not do -j9, depending on your number of cores, and it might not be WORKING_DIRECTORY for you depending on your folder structure. note that if you haven't built the base AOSP system, framework, etc, then it can take along time as it still builds all that stuff I think. I'm currently getting an error doing this (I haven't done it in a while), that I thinnk is due to not building the complete system before hand. This should at least get you started. There are google groups centered around git, repo, and AOSP too... they are great soruces of info too.

If you mess up the code, you can restore it from the git repository (either local or remote), depending on what you have done. But that is another long post...

*EDIT* : if you do make -j9 showcommands DeskClock, it will build all the dependencies too. SO you don't have to do the full path to the project you want to build. https://groups.google.com/forum/#!topic/android-building/yJtA9X5SevE
 
Last edited:
Thank You, dhworph, for full answer. I will check/test it tomorrow and back here to post results.

While searching for answer i fould this:
When developing you can build individual components pretty fast. By using the following command:
mmm <component_directory_name>
For example:
mmm external/rsync

so basically thats the same way and should work.

Update:
So i tried to add hello world app to custom rom and everything went good:
1. added app to packages/apps/ and included it to product packages
2. run mm in packages/apps/APP_FOLDER
3. run make in android source directory
Basically, if you would change any application code, you should follow the same procedure - mm on app and make on whole source.
 
Last edited:
Re: [GUIDE] Compiling Android from Source for the Galaxy Nexus

Okay. So I am embarassed to say this, but I am actually at my senior year as a computer engineer. that being said, I have just enrolled in a course that discusses Android Forensics. I am not as savy with software as I am with hardware (yet another dumb computer engineer :P). I am interested in learning how to make these roms and how they are related to app development. I think this tutorial to build andorid from scratch is fantastic. i have followed all the steps and stopped at this one because I wasnot sure if I should proceed. So I see you talk about binaries for the Verizon Galaxy Nexus. Does this mean that all of this is not applicable to my tmobile Galaxy S2 ?

The reason why I am interested in building android from scratch is so that I can gain root access to the android file system as if it was a part of ubuntu file system. Am I doing the right thing? should I keep on with the steps here although my phone is not a Verizon Galaxy Nexus? I looked for Galaxy S2 Binaries but I couldnt find them on line. Am I looking at the wrong place?

How is this (what is being done here) linked to app development? I understand that in order for a third party (like my self) to be able to run apps on Android that are not on Google Play, you need to ROM or Flash a device. Are there any other advantages to ROMing a device?

I really want to know this like the back of my hand. I hope that I could be pointed in the right direction. I am running Ubuntu 12.04 (64 bit).

"Generally, you can find all of the binaries and drivers for any AOSP Nexus device on this page.

There are four binaries needed for the Verizon Galaxy Nexus in order to make a working Jelly Bean/JRO03C/4.1.1 build."
 
Re: [GUIDE] Compiling Android from Source for the Galaxy Nexus

I have a couple questions about what i'm working on. First issue, when i type "lunch" then make my selection, I get this:
Code:
Trying dependencies-only mode on a non-existing device tree?

Second, when I build, and then try to flash my build, I get this:
Code:
error executing the updater binary

If anyone has any thoughts on this, it's greatly appreciated.
 
Re: [GUIDE] Compiling Android from Source for the Galaxy Nexus

How do I get the proprietary binaries? I''m not using a Nexus device, I''m using a Huawei Y200 and I can''t find any proprietary binaries for it and no tutorials how to get them! PLEASE help!
 
Re: [GUIDE] Compiling Android from Source for the Galaxy Nexus

Thank you very much for this guide. This was the first guide that actually explained some things, like the userdebug or how to make a flashable zip.
 
Hi
In performing step 2 of JDK installation when i type
sudo apt-get update
i get an error
E: Malformed line 55 in source list /etc/apt/sources.list (URI parse)
How can i remove this error
 
Great giude thank you! You have added a few elements that other guides on other sites have left off , that helped me with my build (ubuntu 12.04 in VM) for maguro. I followed your instructions for importing the proprietary binaries ( the right ones for maguro) , but when I flashed my new ROM onto my phone , it didn't recognize that a sim card was in the phone , and the gps didn't work , then it crashed . Restarted it and it hung at the boot logo . I'll start looking for solutions later , unless someone wants to make things easy. Thanks again for this simple informative thread.
 
Awesome tutorial! Add another successful build to the list! I am going through my second compile today after adding the fixes for GPS and Camera on toro 4.3.

Anyone have a tutorial or resource on how to UPDATE for 4.4? Do I go through the same process and initialize a new folder for 4.4?

Edit: And in case anyone is getting an error for their apt sources its from adding the line: sudo add-apt-repository "deb Index of / lucid partner"

I changed it to: deb http://archive.canonical.com/ubuntu lucid partner
And below that the line was commented out, I removed the # and replaced with: deb-src http://archive.canonical.com/ubuntu lucid partner

This was done in: /etc/apt/sources.list
Then run sudo apt-get update and should be gtg.
 
Last edited:
Thank you so much for compiling such a wonderful content. I am using Ubuntu 12.04. My build environment looks good. I downloaded a copy of the master branch. I have some questions like
1- Where do I get the binaries I need for Samsung Note 3?
2- How do modify one of the stock versions in Eclipse? I noticed some posts from the people who have done it. I am reading through them. Basically I need to know how do I open one of the andorid branches in Eclipse; do I import it?
Thanks
 
Last edited:
I tried the patch you mentioned, and still get the error. I also did a lunch clubber, and tried again. I do not see a src file or folder in my WORKING_DIRECTORY. Is that the casue? Shall I add a link to where /src resides?

The link posted earlier had the resolution; you need to edit the file guava/src/com/google/common/collect/Maps.java and replace lines 228/229 with what's shown in green. See below:

- public static <C, K extends C, V> TreeMap<K, V> newTreeMap(
- @Nullable Comparator<C> comparator) {

+ public static <K, V> TreeMap<K, V> newTreeMap(
+ @Nullable Comparator<? super K> comparator) {
 
Hello mates i try to get a rom based on cm10.1 for galaxy w, compilation takes more than 2 hours but it wont boot after flashing, is the problem with kernel or 3d driver as some one told me!
thanks
 
Stumbled across this after a Google search of the make error: xda-developers - View Single Post - [Tutorial] Compile JB on Ubuntu

Applied this patch: https://github.com/CyanogenMod/andr...mmit/c8b97210aa31c9b80b5fd136d8617ebe4e731e09

And it compiled perfectly! Just downloaded Jelly Belly's 7-14 GApps, gonna get to flashing and see if it worked.

Again, huge thanks to dmmarck for this killer writeup, and Andrew Ruffolo for the make clobber pointer, lol. :)

I tried the above patch; it did not work for me. Am I the only one who is in this situation? I still see the src not found message. Did this patch address the issue for everyone?
 
I searched this thread for the following error, and I did not find anything. Basically I built my first image successfully, and now I am trying to deploy it to my handset by moving the zip file to the external sd card, and using TWRP to install it. I get the following messages: E: Unable to mount '/usbstorage' Full SELinux is present In istalling '/external_sd/full_toroplus-ota-eng.root.zip checking for MD5 file Skipping MD5 check: no MD5 file found. assert failed: getprop ('ro.product.device") == "toroplus" || getprop ("ro.bild.product") ==toroplus" e:error executing updater binary in zip 'external_sd/full_toroplus-ta-eng.root.zip' error flashing zip '/external_sd/full_toroplus-ota-eng.root.zip Updating partition details.. E:unable to mount 'usbstorage'
I thought the sd card may have issues, but when the phone is connected to the pc, I see the sd card just fine. I am also able to move files to it.
 
I searched this thread for the following error, and I did not find anything. Basically I built my first image successfully, and now I am trying to deploy it to my handset by moving the zip file to the external sd card, and using TWRP to install it. I get the following messages: E: Unable to mount '/usbstorage' Full SELinux is present In istalling '/external_sd/full_toroplus-ota-eng.root.zip checking for MD5 file Skipping MD5 check: no MD5 file found. assert failed: getprop ('ro.product.device") == "toroplus" || getprop ("ro.bild.product") ==toroplus" e:error executing updater binary in zip 'external_sd/full_toroplus-ta-eng.root.zip' error flashing zip '/external_sd/full_toroplus-ota-eng.root.zip Updating partition details.. E:unable to mount 'usbstorag22e'
I thought the sd card may have issues, but when the phone is connected to the pc, I see the sd card just fine. I am also able to move files to it.



Sent from my SM-G900P using Xparent BlueTapatalk 2
 

Forum statistics

Threads
955,371
Messages
6,964,595
Members
3,163,265
Latest member
investcan