Compiling Android at home for fun and profit..

These are basically my personal notes for doing this, I am sharing them so that others can hopefully get started faster than I did.  the information out on the internet is not complete and it's scattered around with bits of outdated guides for 2 year old distros.   Good luck.


Note: you need a 64 bit install of debian.  And you need 16gb of ram/swap to even think of compiling this as well as 60gb free storage space.  Android is a monster, an unwieldy scary monster.

Okay, so first you're gonna need to grab the SDK from the developer's site. If you don't have it, here's the link to the developer's site that contains the SDK: http://developer.android.com/sdk/index.html Download the one for Linux  under "download for other platforms....  it's at the bottom as a tgz.  You can get the bundle if you want to also set up an application development environment.  I am not covering that aspect in this post.

Install real Java...  JRE6 is what I am using...

http://ddmytrenko.blogspot.com/2012/02/installing-sun-java-6-jdk-on-debian.html  This was the only way I was able to get real java installed under Wheezy.


Extract the android SDK and then mv android-sdk-linux  ~/androidsdk

cd ~/androidsdk/tools
./android

I check on SDK tools, SDK platform tools, Android 4.0.3 and Android 4.0..  It's what I am using for my project... you can install all that you want.

Now click on the "install packages" at the bottom, accept the license, and then install.  This is going to take a very long time unless you have the InternetII available to you.  While that is downloading, we can set up our environments...



#AndroidDev PATH
export PATH=${PATH}:~/androidsdk/tools
export PATH=${PATH}:~/androidsdk/platform-tools

 add the above to you ~/.bashrc file.

vi /etc/udev/rules.d/51-android.rules

Code:



SUBSYSTEM=="usb", ATTRS{idVendor}=="0bb4", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0502", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="12d1", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="1004", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="22b8", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="04e8", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0fce", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0489", MODE="0666"
SUBSYSTEM==”usb”, ATTRS{idVendor}==”18d1″, SYMLINK+=”android_adb”, MODE=”0666″
SUBSYSTEM=="usb", ATTRS{idVendor}=="04e8", MODE="0666", GROUP="plugdev"


chmod a+r /etc/udev/rules.d/51-android.rules

Now we need to set things up for compiling.....   The one step that all online guides miss...


dpkg --add-architecture i386
apt-get update

This is highly important as you will never get everything installed without it.  Now we can install the tools we need....



Code:
$ sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev libc6-dev lib32ncurses5-dev ia32-libs x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown libxml2-utils
Note:  http://source.android.com/source/initalizing.html  for more details from Google on this process..



http://forum.xda-developers.com/showthread.php?t=1162858 Is where I got much of my information,  but some is a little out of date, for example installing Java is completely wrong now.  you MUST have real sun java to compile android.

Comments