Apr 20, 2011

building the android adt for eclipse

After building the android source code and the sdk. I tried to build the adt as well.
But remember when you make adt, android will delete the .sdk and the .img which generated from android source code. (I took a lot of time to make the image files T T )
Therefore, my advice is backup those file before building the android adt.

OS: ubuntu 10.10
java version: sun-jdk1.5

Ok, now this is how I built my android adt.
1. Download  eclipse from here. (I prefer Download manually. When I use apt-get install eclipse, the building process failed.)
P.S I prefer the RAP and RCP version (since the package is smaller).

2. After downloading, extract the file to any directory you want.
   for example: ~/eclipse

3. set the environment variable ECLIPSE_HOME.
    export ECLIPSE_HOME=${the directory you extract your eclipse}

4.the final step is to make the adt using the script contain in the source code.
    ${android home}/tools/eclipse/scripts/build_server.sh ${destination-directory}
P.S the build_server.sh script may be contains in different folder depend on which version of source code you download
           ${android home} is where your android source code is
           ${destination-directory} is where you want to put your adt zip file.

After all these steps, you can see a zip file in your destination folder.

reference website: Build android device tool for eclipse

Apr 18, 2011

building the android sdk

After compiling the android source, It's time to compile the sdk.
Remember before start compiling the sdk, you need to use the sun jdk 1.5.
use this command: update-alternatives --config java 
to switch to jdk5.
However, when I'm compiling the sdk when follow the above steps, there are still error.
My solution is:
1. use lunch sdk-eng before make sdk(if the error still occur)
2. remove all the java sdk in my ubuntu such as openjdk and sun-java1.6.jdk(except jdk5)

And after these two steps, I successfully finished compiling the sdk
you can find the jdk in ~/out/host/${your_machine}/sdk
here is the layout:
drwxr-x--- 3 user user      4096 2011-04-18 10:11 .
drwxr-xr-x 9 user user      4096 2011-04-18 10:10 ..
drwxrwx--- 7 user user      4096 2011-04-18 10:10 android-sdk_eng.user_linux-x86
-rw-r--r-- 1 user user 172889941 2011-04-18 10:11 android-sdk_eng.user_linux-x86.zip
-rw-r--r-- 1 user user    648232 2011-04-18 10:11 sdk_deps.mk

steps review:
                     sudo update-alternatives --config java(change to jdk5)
                     lunch sdk-eng
                     make sdk

Before building the android source

What I forgot to mention in the previous is that the environment setting.
Before we start downloading and compiling the android source code, there are
some important stuff we need to do first.
1.according to the website, we need to download the jdk6 for Gingerbread and newer. And jdk5 for froyo or older.

  The following is how to do this.
   add deb http://us.archive.ubuntu.com/ubuntu/ jaunty multiverse
          deb http://us.archive.ubuntu.com/ubuntu/ jaunty-updates multiverse
   in your /etc/apt/source.list
   and sudo apt-get update
          sudo apt-get install sun-java5-jdk(for jdk5)
after that the sun java jdk5 is installed.
you can use : update-alternatives --config java 
to change which version you want.

2. the rest of the package is just like the website says. follow those steps and you can start download and compile your android.

compiling android source code

Yesterday, I finally finished compiling the android source code. It took me the whole afternoon to accomplish this job.
The following is how it work.
My environment is: ubuntu 10.10 netbook edition. 

1.download the android source code.(Tooks me lots of time. 5GB source code)
    this step is referenced from the android official website.
2.compile the android source code
    the official website has it all. However, there are some detail that the website doesn't mentioned.
     when compiling the source code, I met two problems.
      a.the first problem happened when compiling the qemu,
         and the solution is install some extra packages.
         sudo apt-get install xllproto-core-dev (provides Xatom.h)
         sudo apt-get install libxll-dev (provides Xlib.h)
      referenced website: Issue 15
     b.another problem is when compiling the adb,
        Error message is like: /usr/bin/ld: cannot find -lncurses
        solution is install an extra package.
        sudo apt-get install libncurses5-dev
     reference website: problem compiling adb....

After these problems, everything works really fine.

And after compile is finished, u will see a directory called "out" in you android root directory.