How can I compile an Android APK from source? There are a couple of tutorials or even questions here about creating an application for Android. But I was wondering, if I just want to compile an application from the available source on Github, I'm not going to develop anything, do I need to install the Android SDK, Eclipse with ADT plugin, and the SDK tools and platforms? 

In GNU/Linux you just have to install the build tools and dependency libraries, not an IDE, which is generally for doing the development. How would you proceed in compiling the APK? Not that I want it to be like GNU/Linux, but what are the required tools just for compiling? And do I need to downgrade my Java version to 6 when I'm compiling for Android 4.1.2 (if Java is needed)?

Also, there are no build instructions on the source, including a few steps on your answer would be highly appreciated!
The minimal requirements for building an Android app are usually the Android SDK and ant. Then, you are able to build the majority1 of projects with the following steps.


If there is no build.xml generate it



  android update project -p . -n $PROJECT_NAME -s



Then build the project with



  ant debug


which will create an .apk signed with your debug key.

All other dependencies range from the used VCS (e.g. git), over the required 3rd party libraries, up to other required build tools (e.g. Android NDK).

1 Why did I write majority? Because there is no definitive answer for such a question, as it simply depends on the used build system and the overall build setup of the project.

Let's have a look at F-Droid's metadata, which is a big database of build recipes for FOSS Android apps. You will find that there are many ways how an Android app can be build. For example goo.TeaTimer has a very clean and short build recipe, namely none, which defaults basically to F-Droid using ant debug to create the .apk. On the other hand, org.transdroid.full requires a few more steps to create the .apk: First the transdroid core library needs to be created, that is the ant -f ../lib/build.xml line in prebuild, then options are disabled with the sed command. Now the final .apk can be built.