[GUIDE][Ubuntu] Compiling Android from Source

dmmarck

Retired Moderator
Dec 28, 2011
8,349
2,594
0
Visit site
How do you apply patches. Sorry for the noon question. Just running into the make/SRC errors. Thanks for this great tutorial!

I haven't applied it so I'll wait for those that did to chime in. May not hurt to shoot them a PM as well :).

And no problem!
 

dually

Well-known member
Jan 16, 2011
57
4
0
Visit site
To make up for my useless rambling earlier, on my build using Ubuntu 10.04, the methods listed in the OP for Java didn't work. What worked for me was:

sudo add-apt-repository ppa:sun-java-community-team/sun-java6
sudo apt-get update
sudo apt-get install sun-java6-jdk

Hopefully that helps the next person that has issues. I discovered that tip from here.

Ok, so in order for this method of installing sun java 6 to work on Ubuntu 12.04, you have to edit your ppa. Type this command "sudo nano /etc/apt/sources.list.d/sun-java-community-team-sun-java6-precise.list" to bring up nano editor. Then change the word "precise" to "lucid", and then type "control x" to save and exit. Then proceed with sudo apt-get update and install.
 
  • Like
Reactions: dmmarck

androidphan88

Member
Dec 15, 2011
13
0
0
Visit site
OP thank you so much for the guide. I am having one issue though.

When i go to compile or make the rom. it gives me this

You are attempting to build with the incorrect version
of java.

Your version is: java version "1.6.0_24".
The correct version is: Java SE 1.6.

Please follow the machine setup instructions at
https://source.android.com/source/download.html

i am using the open jdk as i could not get the sun jdk to install, i have even tried several ways to get the sun jdk to install with no luck. please help
 

dmmarck

Retired Moderator
Dec 28, 2011
8,349
2,594
0
Visit site
OP thank you so much for the guide. I am having one issue though.

When i go to compile or make the rom. it gives me this

You are attempting to build with the incorrect version
of java.

Your version is: java version "1.6.0_24".
The correct version is: Java SE 1.6.

Please follow the machine setup instructions at
https://source.android.com/source/download.html

i am using the open jdk as i could not get the sun jdk to install, i have even tried several ways to get the sun jdk to install with no luck. please help

No worries--check the troubleshooting/fixes post, I believe it's the fourth one on the first page. There's a fix there for that and there's a few ways to install the JDK as well. Let me know if you need any help from there :).
 

orrions

New member
Jul 20, 2012
1
0
0
Visit site
root@panji-virtual-machine:/home/panji/android4.0# make update-api
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=4.0.1
TARGET_PRODUCT=full
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a
HOST_ARCH=x86
HOST_OS=linux
HOST_BUILD_TYPE=release
BUILD_ID=ITL41D
============================================

find: `src': No such file or directory
make: *** No rule to make target `out/target/common/obj/PACKAGING/public_api.txt', needed by `update-api'. Stop.

Does any one know about thats thinks?
anything wrong about it
need help please
 

dmmarck

Retired Moderator
Dec 28, 2011
8,349
2,594
0
Visit site
If you check the troubleshooting post as well as a few pages there were some folks dealing with this same issue. Good luck!
 

slashsarc

New member
Jul 21, 2012
3
1
0
Visit site
Hello,

First, I would like to thank the OP for creating this guide.

I would like to create a stock, fully-working, and as close to a factory image as possible Jelly Bean ROM for my VZW Galaxy Nexus. I would like to be able to do this *without* downloading any additional tools (like clockwork mod, or nandroid, etc.). I would only like to use the official tools, such as adb to perform this task.

I get that the AOSP needs to be downloaded, along with the proprietary drivers for the GN. That then needs to be built, and then flashed over to the device utilizing ADB.

So far, it appears to building OK for me following the instructions posted.

The problem, however, is GAPPS. Another user asked earlier how GAPPS are actually obtained. It was suggested that the GAPPS should be obtained from one of the other JB ROMS. However, I am still curious as to how those other ROM maintainers obtained the GAPPS in the first place, and how to actually flash them onto the device.

Thus, these are my questions:
1.) Can they (GAPPS) simply be included with the ROM during the build phase (much like the proprietary drivers)?
2.) If not #1, then how can they be flashed over with ADB?
3.) Which GAPPS would work with the VZW Galaxy Nexus if building a ROM in this manner? (Assume that I was a Google employee making this ROM for the device)
4.) Can the built rom image itself be run in the android emulator? I would much rather not have to use my phone, which I need to use and be stable, as a testing device to play around with this.

I really don't understand why Google doesn't just include the GAPPS as a proprietary component similarly to the proprietary drivers.

Thank You
 
  • Like
Reactions: dmmarck

dmmarck

Retired Moderator
Dec 28, 2011
8,349
2,594
0
Visit site
Hello,

First, I would like to thank the OP for creating this guide.

I would like to create a stock, fully-working, and as close to a factory image as possible Jelly Bean ROM for my VZW Galaxy Nexus. I would like to be able to do this *without* downloading any additional tools (like clockwork mod, or nandroid, etc.). I would only like to use the official tools, such as adb to perform this task.

I get that the AOSP needs to be downloaded, along with the proprietary drivers for the GN. That then needs to be built, and then flashed over to the device utilizing ADB.

So far, it appears to building OK for me following the instructions posted.

The problem, however, is GAPPS. Another user asked earlier how GAPPS are actually obtained. It was suggested that the GAPPS should be obtained from one of the other JB ROMS. However, I am still curious as to how those other ROM maintainers obtained the GAPPS in the first place, and how to actually flash them onto the device.

Thus, these are my questions:
1.) Can they (GAPPS) simply be included with the ROM during the build phase (much like the proprietary drivers)?
2.) If not #1, then how can they be flashed over with ADB?
3.) Which GAPPS would work with the VZW Galaxy Nexus if building a ROM in this manner? (Assume that I was a Google employee making this ROM for the device)
4.) Can the built rom image itself be run in the android emulator? I would much rather not have to use my phone, which I need to use and be stable, as a testing device to play around with this.

I really don't understand why Google doesn't just include the GAPPS as a proprietary component similarly to the proprietary drivers.

Thank You

You have two options with GAPPs--take a provided zip package and "flash" it like you would the otapackage.zip or any other ROM, or open up your otapackage.zip and place the apks in system/app. This would occur after the rom is built, for reasons probably similar to their "exclusion"--the rightsholders prefer them to be separate.

If you try want to, you could in theory use adb to push the GAPPs to system/app. You wouldn't really "flash" them. Your other option would be to use CWM/custom recovery temporarily--install the fastboot images, adb push the GAPPs zip, boot (don't flash) the recovery image, then use your "temporary" CWM to flash the GAPPs zip. Once done, reboot and you'll have a stock "complete" rom.

I have not used the emulator myself, so hopefully someone else can explain.

For the GAPPs packages, if you go to goo-inside.me, they have a "signed" 7/17 package of GAPPs--it says experimental but "everyone" has been flashing it without harm. My suggestion, if you want, is to take that zip, unzip it, and start copying things into your rom--or using ADB to push it after you installed the images.

In this regard, it's really much easier to create the update/otapackage zip than the images.

Lastly, regarding its separation--just like any property right, the rightsholder of the GAPPs choose this path. Heck, even things like Gmail and Maps--which used to be included in GAPPs zips--are no longer included because they are available on the market.
 
  • Like
Reactions: slashsarc

slashsarc

New member
Jul 21, 2012
3
1
0
Visit site
Thank you for replying.

The only reason why I would need GAPPS is to get the Market app installed. Without it, you can't install any apps.

Working with the .zip files, I would assume that you would need to use nandroid/CWR... How exactly can you use them temporarily? Are they simple to uninstall? (Sorry for asking uber-beginner questions)

The big thing that I would like to achieve is to use Jelly Bean right now, and then go back and use the official Verizon approved Jelly Bean ROM once they decide to release it. So, I guess I could always use nandroid/CWR (What's the main difference btw? The last time I did any rooting and ROM installing was with the OG Droid), and then completely wipe the phone with the official ROM when it's released.

Again, thank you so much for the help! :)
 

dmmarck

Retired Moderator
Dec 28, 2011
8,349
2,594
0
Visit site
Thank you for replying.

The only reason why I would need GAPPS is to get the Market app installed. Without it, you can't install any apps.

Working with the .zip files, I would assume that you would need to use nandroid/CWR... How exactly can you use them temporarily? Are they simple to uninstall? (Sorry for asking uber-beginner questions)

The big thing that I would like to achieve is to use Jelly Bean right now, and then go back and use the official Verizon approved Jelly Bean ROM once they decide to release it. So, I guess I could always use nandroid/CWR (What's the main difference btw? The last time I did any rooting and ROM installing was with the OG Droid), and then completely wipe the phone with the official ROM when it's released.

Again, thank you so much for the help! :)

No problem, it's my pleasure.

Yes, GAPPs includes the Play Store/Market APK. Without it, you cannot "signin" and you cannot use the market (b/c it doesn't exist).

A nandroid is a term used for backups--when you create a backup of your system, data, etc., that backup is a "nandroid." Some us, myself include it, also use it as a verb--to nandroid is to back up.

CWM is a custom recovery. Your stock recovery is very limited, and without a custom one, you cannot install ("flash") some packages. It also adds options that are effective tools for the rooter/flasher.

In using CWM or any custom recovery, you have two options--installing it (flashing it) or booting from it.

For example, to flash the recovery image, you'd use a fastboot command like this:

$ fastboot flash recovery recoveryimage.img

However, if you wanted to simply boot from it--thus, not install it but still use it, you would do something like this:


$ fastboot boot recovery recoveryimage.img

See the difference? You're telling fastboot that you want to boot the recovery image instead of installing it to the recovery "partition" or area.

So, if you want to be absolutely "stock"--meaning no custom recovery--you simply boot the recovery image with fastboot, install your zips (for instance, the otapackage.zip and the GAPPs zip), reboot your system, and you're left with a stock recovery and "stock" rom.

If you want to go back to stock, the quickest and most effective way would be to follow my factory images guide located in this very subforum. Basically, what you'd do is take the image files and flash them over with fastboot. If you want to take it ALL the way back, you can simply relock the device (this presumes you're unlocked, which you should be when "testing" stuff out for a variety of reasons).

I presume you're unlocked now, and if you're not, I'd do it, but be cautious--it will wipe everything including the "sdcard" folder. So back your stuff up :). Unlocking allows you to flash unsigned packages and gives you a load of freedom when testing. I'm also 90% sure you need to be unlocked to flash a custom recovery, but that's only because I've never done one (flash a recovery) without the other. Perhaps someone will chime in with regards to that.
 
  • Like
Reactions: slashsarc

plasmoidia

Member
Jul 6, 2010
13
4
0
Visit site
I presume you're unlocked now, and if you're not, I'd do it, but be cautious--it will wipe everything including the "sdcard" folder. So back your stuff up :). Unlocking allows you to flash unsigned packages and gives you a load of freedom when testing. I'm also 90% sure you need to be unlocked to flash a custom recovery, but that's only because I've never done one (flash a recovery) without the other. Perhaps someone will chime in with regards to that.

You are correct. Being locked prevents you from using a custom recovery. You cannot even boot to a custom recovery without unlocking.

As far as backup before unlocking, I have been playing around with the instructions from here:
[GUIDE] Full Phone Backup without Unlock or Root - xda-developers

I have not had a whole lot of success with it, though. The process seems to stop prematurely rather easily with no indication of whether or not it actually finished.
 
  • Like
Reactions: slashsarc

lelandjs

New member
Feb 26, 2011
1
0
0
Visit site
What follows is a series of head scratching errors that all the Googling in the world hasn't helped me with:

find: `src': No such file or directory...
I was able to fix the second part of this error thanks to the guide, but I'm still getting the find: 'src' and "PRODUCT_COPY_FILES *** ignored." errors. I stopped it to look and wasn't too concerned because it looked like most of the ignored files were ringtones (I use my own, so no big deal) but then I noticed this line:

PRODUCT_COPY_FILES frameworks/native/data/etc/android.hardware.telephony.cdma.xml:system/etc/permissions/android.hardware.telephony.cdma.xml ignored.

Which seems like it would, without a doubt, result in a nonworking build. At the very least, a build that couldn't get a signal.

Any advice?

[Edit: Well, I finished the build and flashed it... and it works fine! Though the version number is 4.0.9.99.999.9999.99999 for some reason. Sigh.]
 
Last edited:

slashsarc

New member
Jul 21, 2012
3
1
0
Visit site
Thank you dmmarck for explaining the bootloader setup, and thank you plasmoidia for showing the backup commands.

dmmarck said:
See the difference? You're telling fastboot that you want to boot the recovery image instead of installing it to the recovery "partition" or area.

In the command you pasted in, where is the recoveryimage.img stored? Is that stored on the device, or locally on the system? (I would assume adb would take the local .img file and send it to the phone to run.) Can you easily download the CWR recovery image without installing it?

I still haven't unlocked my phone yet. Honestly, I'm still on the fence on whether or not I want to go through with this just yet, especially since I read some articles about all other GN's getting JB within the next month or two. However, you have convinced me that CWR is the way to go, since it does make it much easier to do this.

I was able to successfully build JB from AOSP, but, unfortunately, I was unable to run it in the Android device emulator.

The primary reason why I'm on the fence is that this is my primary phone, and I *need* the phone to be stable and work 100%. I don't really want to take a chance and screw it up, especially since this would be first time I would build it from source. Has anyone tried this had any missing features? Does the camera, wifi, and all other features work fine?

Thanks.
 

dmmarck

Retired Moderator
Dec 28, 2011
8,349
2,594
0
Visit site
I was able to fix the second part of this error thanks to the guide, but I'm still getting the find: 'src' and "PRODUCT_COPY_FILES *** ignored." errors. I stopped it to look and wasn't too concerned because it looked like most of the ignored files were ringtones (I use my own, so no big deal) but then I noticed this line:

PRODUCT_COPY_FILES frameworks/native/data/etc/android.hardware.telephony.cdma.xml:system/etc/permissions/android.hardware.telephony.cdma.xml ignored.

Which seems like it would, without a doubt, result in a nonworking build. At the very least, a build that couldn't get a signal.

Any advice?

[Edit: Well, I finished the build and flashed it... and it works fine! Though the version number is 4.0.9.99.999.9999.99999 for some reason. Sigh.]

It appears you synced with the master and not the specific branch. That correct?





Thank you dmmarck for explaining the bootloader setup, and thank you plasmoidia for showing the backup commands.



In the command you pasted in, where is the recoveryimage.img stored? Is that stored on the device, or locally on the system? (I would assume adb would take the local .img file and send it to the phone to run.) Can you easily download the CWR recovery image without installing it?

I still haven't unlocked my phone yet. Honestly, I'm still on the fence on whether or not I want to go through with this just yet, especially since I read some articles about all other GN's getting JB within the next month or two. However, you have convinced me that CWR is the way to go, since it does make it much easier to do this.

I was able to successfully build JB from AOSP, but, unfortunately, I was unable to run it in the Android device emulator.

The primary reason why I'm on the fence is that this is my primary phone, and I *need* the phone to be stable and work 100%. I don't really want to take a chance and screw it up, especially since this would be first time I would build it from source. Has anyone tried this had any missing features? Does the camera, wifi, and all other features work fine?

Thanks.

You place the image on your computer and use the cd command (change directory) to go to the folder.

Or, if you're on Ubuntu, simply drag and drop the file into the terminal after typing in the beginning of the command.

I will respond at length later once I'm at a computer :).

Sent from my Galaxy Nexus using Xparent Cyan Tapatalk 2
 

letM3in

New member
Feb 24, 2011
4
1
0
Visit site
Thanks for taking the time to put together a tutorial--nice work.

I'm working on a similar build of CM10 for toro. What are you doing for the camera, gps, and nfc binaries since google cannot provide them?
 

Paul627g

AC Moderator All-Star
Moderator
Nov 25, 2010
15,963
2,752
0
Visit site
dmmarck my friend... Guide worked great. Had to go off the map to get Java installed but that seems to be a given for many.. Otherwise everything else is spot on !

FWIW, Total build time... 69 minutes :)

I'll just leave this here...

attachment.php
 
  • Like
Reactions: dmmarck

dmmarck

Retired Moderator
Dec 28, 2011
8,349
2,594
0
Visit site
Thanks for taking the time to put together a tutorial--nice work.

I'm working on a similar build of CM10 for toro. What are you doing for the camera, gps, and nfc binaries since google cannot provide them?

Honestly, I presume they're ready to rock with cm10. I had an issue just syncing with them so I put that project off. ;)

Sent from my Galaxy Nexus using Xparent Cyan Tapatalk 2
 

letM3in

New member
Feb 24, 2011
4
1
0
Visit site
Honestly, I presume they're ready to rock with cm10. I had an issue just syncing with them so I put that project off. ;)

Sent from my Galaxy Nexus using Xparent Cyan Tapatalk 2

Nope, not ready yet; although I'm sure they'll get to it before long.

Until then, I'm trying to figure out the camera, gps, and nfc binaries. Did you pull these from a 4.0.4 toro?
 

Forum statistics

Threads
943,146
Messages
6,917,510
Members
3,158,843
Latest member
samyblaze