7

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!

1 Answer 1

9

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.

11
  • Your command doesn't work because it lacks a AndroidManifest.xml, and the error from running is "Unable to load key from Google Drive, retrying: null" Commented Jan 4, 2014 at 21:06
  • The command was incorrect rendered. I've edited it. It's the same command F-Droid and I use within my Android project to generate build.xml. I've took a closer look at keepshare: It uses sbt (simple build tool) and is a good example for a project which does not use ant but instead some other build tool. Therefore the commands and tools to build the project differ.
    – Flow
    Commented Jan 4, 2014 at 21:32
  • The answer here only works for java apps; keepshare has Scala source code which is why SBT is necessary. There are very few Scala apps and F-Droid doesn't support it. Also ant is deprecated—gradle is the future for building Android apps. The app label in AndroidManifest.xml is Keepass database access so that's how it should appear in the launcher.
    – daithib8
    Commented Jan 6, 2014 at 19:31
  • 1
    Your answer still isn't relevant for Keepshare. The real answer is provided in comment #3.
    – daithib8
    Commented Jan 6, 2014 at 20:32
  • 1
    That's right. I think more users benefit from an general answer compared to a specific one. OP already figured out that SBT is the used build tool.
    – Flow
    Commented Jan 6, 2014 at 20:35

Not the answer you're looking for? Browse other questions tagged .