Building Android on Gentoo

Ok, it is generally best practice to use Ubuntu  for building android but if you are a Gentoo fan and don’t want to mess with a vm you’ll have to bypass some bumps first.

So let’s start. Firstly you need sun-jdk6. icedtea-jdk won’t do the trick. So let’s get sun-jdk6 firstly. I’m going to just pass the commands you need and it should be self explanatory if you know what you are doing.

Download java and put it at /usr/portage/distfiles/

cd /usr/portage/distfiles

Then copy paste the exact same lines as below to auto-accept all licenses.

cat >> /etc/make.conf <<END

Then let’s unmask sun-jdk. It’s masked for security reason but we really need this. So edit  package.unmask with your favorite editor ( vi /etc/portage/package.unmask ) and add at the bottom


Ok we’re ready let’s emerge

emerge dev-java/sun-jdk

After you’ve done select the appropriate package by issuing

java-config --set-system-vm sun-jdk-1.6

Afterwards let’s emerge all the packages we need to compile android.

emerge git app-crypt/gnupg flex bison gperf libsdl wxGTK squashfs-tools curl ncurses zlib schedtool perl-Switch zip unzip emul-linux-x86-baselibs emul-linux-x86-compat emul-linux-x86-cpplibs

You should be all done expect one last thing. repo sync etc. and before you start your build goto core/ and comment out the following lines.

+#ifeq ($(wildcard $(HOST_JDK_TOOLS_JAR)),)
+#$(error Error: could not find jdk tools.jar, please install JDK6, \
+#    which you can download from <a href="" target="_blank"></a>)

You are good to go! Happy android building!


#android, #building, #endif, #gentoo, #ifeq, #requires_openjdk, #sun-jdk