Search code examples
androidlinuxubuntuandroid-source

Is it possible to build AOSP project (Gingerbread) in kubuntu12.04 (xubuntu)?


I work with older releases of Android (Gingerbread 2.3.4). To develop for these versions I use now Ubuntu 10.04. At the same time, I would like to use more recent version: 12.04 or maybe 12.10. It is written here:

Building on Ubuntu 12.04 is currently only experimentally supported and is not guaranteed to work on branches other than master.

So here is my question, has anybody tried to build old versions of Android on Ubuntu 12.04? I do not like new unity interface so I also consider xfce or kde. That's why here is the second question, will I have any troubles with building if I change window system?


Solution

  • Yes, it is possible to build Gingerbread on Ubuntu 12.10.

    Biggest problem is that Ubuntu 12.10 has newer gcc 4.7, which is very strict. It is possible to fix it by patching Android source to be compliant with new gcc requirements. However, this can be difficult to do, especially when it involves patching older kernel sources.

    You can bypass this by simply installing older gcc 4.4 (which is default version in Ubuntu 10.10).

    sudo apt-get install gcc-4.4-multilib g++-4.4-multilib
    

    After that, you need to make gcc 4.4 to be the default compiler for your Android compilation. Easiest way is to simply symlink gcc, g++, cpp to point to older versions and add it to PATH:

    mkdir ~/bin
    cd ~/bin
    ln -s /usr/bin/g++-4.4 g++
    ln -s /usr/bin/gcc-4.4 gcc
    ln -s /usr/bin/cpp-4.4 cpp
    # you might want to add line below to ~/.bashrc:
    export PATH=$HOME/bin:$PATH
    

    Now, you need to have Java installed. Unlike newer Android 4, Gingerbread can be built using OpenJDK, so you should be able to simply

    sudo apt-get install openjdk-6-jdk
    

    to get working JDK.

    Also see this thread.