[Nexus 7 Android Development] RealPariah:
UPDATE [2013.08.10]: IN ORDER TO BUILD PARANOID 3.95+ [ANDROID 4.3] SUBSTITUTE THE FOLLOWING IN REPO INIT COMMAND: jb43-legacy so that it replaces the jellybean-legacy on the very end. IF YOU HAVE A REPO ALREADY I AM SORRY TO SAY YOU WILL NEED TO ESSENTIALLY HOSE THE WHOLE THING [DELETE IT] AND RUN REPO INIT FROM SCRATCH, BUT YOU ARE ALREADY ALL SET NO OTHER CHANGES NEED BE MADE JUST DELETE IT ALL [DONT FORGET .repo] AND START AGAIN FROM FIRST REPO INIT ON...

Repo Init Line for building Paranoid 3.95 [Android 4.3]

repo init -u git://github.com/ParanoidAndroid/manifest.git -b jb43-legacy

YOU WILL NEED TO USE NEWER GAPPS AND PARANOID PREFS [FROM OFFICIAL 3.95]:

PA PREFS - OFFICIAL PARANOID 3.95 [Yes it's on Google Docs, but from official channels I promise]

4.3 GAPPS [takes you to goo.im repo and just be sure to choose 4.3 version]

Folks,

I took the time to delve in to ROM source compilation and after months of researching multiple guides and installing everything from the ground up countless times I can now bring you a Nexus 7 specific guide updated for xUbuntu [or any Debian really] 13.04. My guides Java steps have it fully integrate in to the OS now so it DOES NOT MATTER IF YOU HAVE MULTIPLE AND DIFFERENT VERSIONS OF JAVA INSTALLED IT WON'T HURT A THING :)!

So here goes, and I will be editing and all as I go:

I would just like to share results from my recent testing with xUbuntu Raring 13.04 [with pre-release updates included]...

Just ran sync and build from scratch for a Grouper early this morning!

I use an Intel i5 8G RAM and xUbuntu 13.04 Raring Ringtail 64-bit [host OS not VM this time, but host or guest in a VM, either way is the same guide :) ]

Compile Time: ~ 60 - 70 min as host OS or ~120-130 Min if I set this up as VM [same Machine with Windows as host].

I know some of the information I list toward the end may be a little long for "power users" and may be a little out of sync [not exactly in line with file examples, but I believe with only a tiny bit of effort to note how to adjust for your own directories and locations you are good to go [which is rather easy if you take your time and be patient with it]. I will continue to update and streamline this as best as I can moving forward. PLEASE if you have CONSTRUCTIVE input drop me a PM or reply with your thoughts and experiences and I will incorporate what is needed.

I had to use this and other guides to basically put together a working build environment.

Here are the deps I used, I had to remove the last entry for the webgtk from the OPs listing] and had to add the 4 on the end relating to gcc++ and included deps as instructed via apt-get when I tried installing others adding one missing package it asked for each time so it's as small as I can make it at this time roughly an 880M download if I remember correctly [sorry fast fast internet here so download sizes don't bother me, but I did take it in to consideration for this guide].

sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev zlib1g-dev:i386 libc6-dev lib32ncurses5-dev ia32-libs x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 lib32z-dev 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 gcc-multilib g++-4.7-multilib gcc-4.7-multilib

That should be good for a copy/paste if not add / to the begining of each line [not including the first with sudo skip that] and let me know I can update. Nevermind it remains one long line just copy then hold shift and ctrl and tap v in terminal window to paste as-is.

Android-51 Rules file for allowing device access to user accounts:

First open said file. Keep in mind you can use any text editor such as leafpad, mousepad or even console based nano if you prefer just use sudo nano not gksudo and gksu works the same and is used for any graphical app to CORRECTLY obtain sudo [you can still use sudo at times but will end up breaking it in some instances so be aware of which to use where]:

$ gksudo gedit /etc/udev/rules.d/51-android.rules

For those used to previous Paranoid source guides will not some differences. This android file is grabbed from AOSP directions and allows granular control of which user is allowed to access which device which is a much more secure way to enable hardware divce access [if you share the system should a non Android versed person be allowed to run ADB commands and possibly damage your device? Just replace the <username> bit with the username who needs access and then copy/paste it down the list. This ios a LINUX requirement so see documentation on probing and adding USB access for a device to find out more on adding new devices not in this listing:

# Change <username> at end of each device line with the username who
# will access said device
# adb protocol on passion (Nexus One)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e12", MODE="0600", OWNER="<username>"
# fastboot protocol on passion (Nexus One)
SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", ATTR{idProduct}=="0fff", MODE="0600", OWNER="<username>"
# adb protocol on crespo/crespo4g (Nexus S)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e22", MODE="0600", OWNER="<username>"
# fastboot protocol on crespo/crespo4g (Nexus S)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e20", MODE="0600", OWNER="<username>"
# adb protocol on stingray/wingray (Xoom)
SUBSYSTEM=="usb", ATTR{idVendor}=="22b8", ATTR{idProduct}=="70a9", MODE="0600", OWNER="<username>"
# fastboot protocol on stingray/wingray (Xoom)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="708c", MODE="0600", OWNER="<username>"
# adb protocol on maguro/toro (Galaxy Nexus)
SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", ATTR{idProduct}=="6860", MODE="0600", OWNER="<username>"
# fastboot protocol on maguro/toro (Galaxy Nexus)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e30", MODE="0600", OWNER="<username>"
# adb protocol on panda (PandaBoard)
SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="d101", MODE="0600", OWNER="<username>"
# fastboot protocol on panda (PandaBoard)
SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="d022", MODE="0600", OWNER="<username>"
# usbboot protocol on panda (PandaBoard)
SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="d00f", MODE="0600", OWNER="<username>"
# usbboot protocol on panda (PandaBoard ES)
SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="d010", MODE="0600", OWNER="<username>"
# adb protocol on grouper/tilapia (Nexus 7)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e42", MODE="0600", OWNER="<username>"
# fastboot protocol on grouper/tilapia (Nexus 7)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e40", MODE="0600", OWNER="<username>"
# adb protocol on manta (Nexus 10)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4ee2", MODE="0600", OWNER="<username>"
# fastboot protocol on manta (Nexus 10)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4ee0", MODE="0600", OWNER="<username>"

Now we need to set permissions on said file:

$ sudo chmod U+R /etc/udev/rules.d/51-android.rules

When I followed the ln -s bit after the dependency download list at top of most other guides I have found in last few run throughs starting from a complete scratch system that the link already existed. If you get the file already exists message continue on and count that as good to go.

After that here is for the Nexus 7 [Grouper] Local_Manifest.xml:

<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<project name="ParanoidAndroid/android_device_asus_grouper" path="device/asus/grouper" remote="github" revision="jellybean" />
<project name="TheMuppets/proprietary_vendor_asus" path="vendor/asus" remote="github" revision="cm-10.1" />
<project name="TheMuppets/proprietary_vendor_broadcom" path="vendor/broadcom" remote="github" revision="cm-10.1" />
<project name="TheMuppets/proprietary_vendor_elan" path="vendor/elan" remote="github" revision="cm-10.1" />
<project name="TheMuppets/proprietary_vendor_invensense" path="vendor/invensense" remote="github" revision="cm-10.1" />
<project name="TheMuppets/proprietary_vendor_nvidia" path="vendor/nvidia" remote="github" revision="cm-10.1" />
<project name="TheMuppets/proprietary_vendor_nxp" path="vendor/nxp" remote="github" revision="cm-10.1" />
<project name="TheMuppets/proprietary_vendor_widevine" path="vendor/widevine" remote="github" revision="cm-10.1" />
</manifest>

Now comes the AWESOME part of my post HOW TO INSTALL JAVA 6 ALONGSIDE ANY AND ALL EXISTING JAVAs ON YOUR UBUNTU [prolly any Debian]!

No Longer do you need to ensure you have only Oracle Java 6 JDK installed and nothing else, but you can have any and as many java versions as you want with this guide! So skip the part in any guide about sudo apt-get purge blah it won't hurt you to have Open JDK or Iced Tea or GCJ just use the reconfigure --java as listed below before running rom-build to ensure it is the Oracle JDK selected.

----------------------------------------------------------------

Here we go obviously adapt the .bashrc and .profile as I have here note you can use any directory structure you desire really.

I will list how to download the 32-bit AND 64-bit versions. Read past the first section of downloading 32-bit to get to the 64-bit relatede link]

[using code tags to hopefully save some room on post let me know if I need to format it up instead]

Manual method
oracle java 6 jre 32-bit
$ wget http://download.oracle.com/otn-pub/java/jdk/6u34-b04/jre-6u34-linux-i586.bin

$ chmod u+x jre-6u34-linux-i586.bin

$ ./jre-6u34-linux-i586.bin

$ sudo mkdir -p /usr/lib/jvm

$ sudo mv jre1.6.0_34 /usr/lib/jvm/

$ sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jre1.6.0_34/bin/java" 1

$ sudo update-alternatives --install "/usr/lib/mozilla/plugins/libjavaplugin.so" "mozilla-javaplugin.so" "/usr/lib/jvm/jre1.6.0_34/lib/i386/libnpjp2.so" 1

$ sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jre1.6.0_34/bin/javaws" 1
or

oracle java 6 jdk 64-bit
$ wget --no-cookies --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F" http://download.oracle.com/otn-pub/java/jdk/6u45-b06/jdk-6u45-linux-x64.bin

$ chmod u+x jdk-6u45-linux-x64.bin

$ ./jdk-6u45-linux-x64.bin

$ sudo mv jdk1.6.0_45 /opt

$ sudo update-alternatives --install "/usr/bin/java" "java" "/opt/jdk1.6.0_45/bin/java" 1

$ sudo update-alternatives --install "/usr/bin/javac" "javac" "/opt/jdk1.6.0_45/bin/javac" 1

$ sudo update-alternatives --install "/usr/lib/mozilla/plugins/libjavaplugin.so" "mozilla-javaplugin.so" "/opt/jdk1.6.0_45/jre/lib/amd64/libnpjp2.so" 1

$ sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/opt/jdk1.6.0_45/bin/javaws" 1

IMPORTANT*choose the java you installed as default
$ sudo update-alternatives --config java

$ sudo update-alternatives --config javac

$ sudo update-alternatives --config mozilla-javaplugin.so

$ sudo update-alternatives --config javaws

Optionally you can set a JAVA_HOME env variable:

export _JAVA_HOME=/opt/jdk1.6.0_45/

Choosing the default Java to use

If your system has more than one version of Java, configure which one your system uses by entering the following command in a terminal window

sudo update-alternatives --config java

This will present you with a selection
In Androids case the following line should be used [be sure it is the same number as listed yours may differ]:

*1 /opt/jdk1.6.0_45/bin/java 1 manual mode

After that I use the following .Bashrc lines at the end of the file:

# gedit ~/.bashrc
# or
# nano ~/.bashrc
# should suffice should gdit not work and you are unsure.
# ^ means the ctrl key when file opens in nano and you see
# quick access commands listed along the bottom of screen]
# so ctrl+o = ^o for saving file and ^x=ctrl+x for eXit.
## Changes to .bashrc won't take effect until you save
## close all terminal windows and open a new terminal window
### Begin copy (could copy all this box if you wish to maintain notes) ###
# Java PATHs
export JAVA_HOME=/opt/jdk1.6.0_45/
export PATH=$PATH:$JAVA_HOME/bin
# Android tools
# I have used a custom directory to move the SDK and my Bin to
# Use ~/bin in place of last entry ~/ just starts in your home dir so same goes
# if sdk is in /home/user/android-sdk/ use ~/android-sdk :) have fun
export PATH=${PATH}:/storage/android/sdk/tools
export PATH=${PATH}:/storage/android/sdk/platform-tools
export PATH=${PATH}:/storage/android/bin/
### End Copy I leave extra blank line at the end usually so hit enter after paste ###

Now I will do the .profile use the same gedit scheme as above but use .profile in place of .bashrc this time.

Again, I use a custom scheme base of /storage/android/paranoid-legacy note how : [colon] is used to separate new entries and the same ~/ rule applies here as well:

## Changes to .profile won't take effect until you save
## close all terminal windows and open a new terminal window
### BEGIN Copy (could copy all this box if you wish to maintain note) ###
PATH="/storage/android/sdk/tools:/storage/android/sdk/platform-tools:/storage/android/bin:$PATH"
### END Copy ###

Now follow the OP where it has you create the ~/bin [or wherever you want it do a sudo mkdir -p /storage/bin and then sudo chown <your linux username> -R /storage (this would create the bin in storage and -p means create /storage if it doesn't exist and then bin (normally in linux if /storage was not there it would not create the bin direcotry as you are asking it until storage is there first. -p does this for you) so just create it where you want. Just update the bin reference in .bashrc and in .profile as well. CHANGES to .profile AND .bashrc DONT TAKE EFFECT UNTIL YOU SAVE THEM AND THEN OPEN A BRAND NEW TERMINAL WINDOW]

Curl the repo python script to this directory you chose

Give it the right permissions [example]:

$ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
$ chmod a+x ~/bin/repo

update .profile to include new bin [if not done above or you just now wish to change it since you copied the above edits]

update .bashrc as to also include new bin location [if not done above or you just now wish to change it since you copied the above edits]

close all terminal windows that are open

open new terminal window

type android hit enter

- you should see the Android SDK GUI start up in a min or 2 if everything is good

to ensure sdk paths are good and download the Android Tools and I suggest any versions of android that correspond to the Android version that you are compiling Paranoid for [I download 4.1.2 and 4.2.2 cause my phone is on 2.53 until I learn to fix that (a T-mobile Galaxy S2 Hercules if anyone can help get it running newest paranoid versions cause it can surely handle it)].

After Android SDK downloads complete

paste the following in to terminal window [ctrl+shift+v] and hit enter. BE SURE YOU ARE IN THE FOLDER YOU WISH TO DOWN PARANOID SOURCE TO BEFORE RUNNING.

If it stops saying the identity blah blah blah just follow on-screen instructions and run something to the effect of git-config --user.email "you@blah.com" [I suggest GMail easier for git tasks if you wish to contribute

and the -user.name "your name"

Use the quotes and I may be slightly off but again if you read the screen it will ask you to run those 2 commands to establish your identity if it is needed.

After you do run the same command a second time to fully complete the repo init. find the .repo folder within your designated paranoid folder and add the Local_Manifest.xml

type repo sync and hit enter after repo init completes successfully and wait awhile for a rather large download of source code.

Restart System if you wish to be overly cautious and ensure everything takes

To Initialize the Repo [in any directory just run the repo init from the directory where you want ALL the source downloaded to BEFORE running repo init! DON'T SAY I DIDN'T WARN YOU]:

$ cd system [or whatever your directory is for housing source and running compiles from]
$ repo init -u git://github.com/ParanoidAndroid/manifest.git -b jellybean-legacy

Now you should be able to run repo syc and get a full sync for grouper!

Just do so before and you will have newest updates to Paranoid Source applied. Then ./rom-build grouper clean and it will not need to go through entering manufacturer and waiting again for those sources since you did the full Local_Manifest [FOR GROUPER OBVIOUSLY FIND YOUR OWN DEVICE TREES FOR OTHERS PLEASE I still need to get my S2 trees and getting the code for Paranoid and all so I am not a repository of local_manifest entries I am sorry in advance.

I just ran a successful compile against the fresh sync from this setup early this morning in 68 Min. I am using xUbuntu 13.04 64-bit on an Intel i5 with 8 Gigs of super top of the line DDR3 [still need more when I get to it LoL].

I hope this helps I know I love the java guide here as it allows you to still install other java setups that apps you install otherwise may want, but you just use the reconfigure --java as listed above after installing any new versions of Java [they may hijack the default setup on install] and you are good to go!

This has taken me MANY attempts and much reading and tinkering to get to this point, so please I hope it helps others as I could not have done it without the help of other guides as a base for their setups, so this is my giving back to the community for it's helping me THANK YOU one and all who provide free information too others in their free time I APPRECIATE IT SO MUCH, THANK YOU

Last note: there have been times I have been stopped from building not because my information or setup wa off, but due to the occasional error introduced in to the code base after repo syncs. I had to Google the one where it bailed on frameworks to find a manual edit around that. Since then [this setup I wrote this on] I had deleted everything did a fresh setup, repo sync and ./rom-build.sh grouper clean and it built in 68 min without me editing anything so for now it should be good.