Start developing Android apps on Fedora in 10 minutes

photo CC-BY

Android is one of the most popular mobile operating systems (and it is based on the Linux kernel too.) However, diving into developing apps for Android can appear to be a bit daunting at first. The following how-to runs you through the basics of setting up an Android development environment on your Fedora machine. The basic workflow is to download the Android SDK, use the SDK to generate a quick first “hello world” application, then test out that application with either a physical Android device or the Android emulator.

Let’s get started!

photo CC-BY

Photo by JD Hancock (CC-BY)

Install needed Dependencies

First up we need to install a few packages from the Fedora Repos to make sure everything works correctly. To install these packages, run the command:

sudo yum install zlib-devel.i686 ncurses-devel.i686 ant

Note that the 32bit libraries in the command above are needed even if you have a 64bit install of Fedora.

Get the SDK

Now we need to create a new directory in your home directory to contain the Android SDK and your first project. I decided to name mine android-development:

mkdir ~/android-development/

Now, go to the Android SDK Download page and Download the SDK for Linux. Note that there are two types of download offered on the Android Download page, in this example we are after the SDK Tools Only option, not the ADT Bundle.

After downloading, unpack the bundle into the android-development/ directory.

Update the SDK

Now that you have the SDK you will need to update it. To do this, we need to go to the tools directory in the SDK, and then run the Android SDK Manager:

cd ~/android-development/android-sdk-linux/tools/

The Android SDK Manager will appear, and will prompt you to install a number of updates. It will install them directly into the android-sdk-linux/ directory.



Set up your PATH variable to point at the SDK

Next up, we need to configure your path variable to point at a couple of directories in the Android SDK so we can run them as commands in bash. So open up the


file in your favourite text editor, and add the following lines to the bottom of the file:

export PATH=$PATH:~/android-development/android-sdk-linux/tools/
export PATH=$PATH:~/android-development/android-sdk-linux/platform-tools/

Now log out of your desktop, and log back in to apply this change.


Create the App

Before we create our app, we need to know what version of the Android API we want to build against. Run the following command to see what Android API versions your SDK can target:

android list targets

I only have the most recent version of android downloaded in my SDK, so I got the following output:

Available Android targets:
id: 1 or "android-19"
Name: Android 4.4.2
Type: Platform
API level: 19
Revision: 3
Skins: WSVGA, HVGA, WXGA800, WVGA800 (default), WQVGA432, WXGA720
Tag/ABIs : no ABIs.

In this output, all we are concerned with is the ID of the API version we want to build against. In the example above, we just need “android-19”

Now, run the following command to create a default Android project (being sure to enter in the correct directory location for the path option and the ID from above for the target):

android create project --target android-19 --name MyFirstApp --path ~/android-development/MyFirstApp --activity MainActivity --package com.example.myfirstapp


Building your Android app

Now that you have done all the prep work, building your first Android app is actually pretty easy. First change into the directory that contains your app:

cd ~/android-development/MyFirstApp

then run the following command to build the app:

ant debug

If the build is successful, the following command will have created a an Android application package file (apk) file at




Test out your app on a real device

Now we have a built APK of our app, it’s time to try it out on an android device. To Install the APK to a device via USB, you need to enable USB Debugging mode on your device. Note that this step is different depending on the android version your device is running.

  • For Android 3.2 or older, the USB Debugging option is under Settings > Applications > Development in the android menus.
  • For Android 4.0 and 4.1 the USB Debugging option is under Settings > Developer options.
  • For Android 4.2 and newer, the USB Debugging option is still under Settings > Developer options, but that menu item is disabled by default. To show the Developer Options, go to Settings > About phone and tap the Build Number item 7 times.

Now you have enabled USB Debugging mode, connect your device to your Fedora machine with a USB cable, and run the following command (make sure you are still in the



adb install bin/MyFirstApp-debug.apk

Now check your phone for the newly installed app (it will be called MainActivity). Run it and bask in all the Hello World goodness:



Test out your app on the emulator

Luckily, If you don’t have a Android device handy, or if you want to try out your app on a different style of device, the Android SDK also includes an the Android Virtual Device Manager to start a whole bunch of Android device emulators. To start the Android Virtual Device Manager, run the command:

android avd

In the “Android Virtual Devices” tab, press the New… button to create a new virtual Android device. Fill out the details in the dialog and press OK:


Start the emulator, and you should see a stock android screen, and some controls:

Now, follow the same steps as if you were installing on a real device. run the following command (make sure you are still in the



adb install bin/MyFirstApp-debug.apk

Now check the emulator for the newly installed app (it will be called MainActivity).



Further Reading

Now you have successfully set up your build and testing envrionment for Android apps on Fedora, the best place to go to get further information about developing apps for android is the Training section at Google’s Android Developer page.

Fedora Project community


  1. Kuehner Joseph

    Thank you for post. I followed your instructions. Install and update seem to be fine.
    When I do

    ant debug

    I get error

    $HOME/android/android-sdk-linux/tools/ant/build.xml:653: The following error occurred while executing this line:
    $HOME/android/android-sdk-linux/tools/ant/build.xml:698: null returned: 132

    Any hints?

    Regards Joseph Kuehner

    • Hi Joeseph,

      It’s hard for me to try to help here (also, i am not a developer, so i may or may not be able to help you 🙂 )

      It might be more beneficial to ask your question over at where there is likely to be more Java people lurking, and is a better interface for getting to the bottom of your issues.

      Just for the record, I tried out my instructions on a clean Fedora 20 (x86_64) machine (from the DVD install)

    • George

      To Joseph-

      I am having the same problem. Did you ever find a solution?


  2. If someone who finds “diving into developing apps for Android can appear to be a bit daunting at first” should he or she really go into ant route.

    Also step number one is always install JDK.

    I would rather do Android Bundle Tools > File > New > Android Application Project > Next > Next > Next. You have a hello world app.

    • Hi Sudhir,

      Personally, i find eclipse kind of daunting, so i decided to go with the command-line route rather than use the Eclipse and install the Android Developer Tools plugin. There are also a few great articles out there that discuss setting up Eclipse for Android development (this one is pretty good.)

      Also, i didn’t explicitly direct installation of openJDK because ant pulls in down as a dependency when you install it.

      • I don’t think there are any professional Android developers who don’t use Oracle JDK and ADT/Android Studio. They are the tools to trade.

  3. Great article!

    There is a littile


    missing in the link to the SDK. Actually it just takes to a 404 page of your site:

  4. Raul Castro


    Thanks for providing this instructions, have you been into the error:
    Error: Could not find or load main class


    • Jan

      I have same problem with android sdk manager, could not find or load main class.. did u fix it? how did u manage it? thank u very much

  5. Yep. Someone should write in the export $PATH variables in the ~/.bash_profile for the beginner android developers stumbling around in the fedora G+ community. Not too sure on the protocols on adding and modifying script files for fedora, might be an issue with the android SDK itself. Someone might include it for fedora.

    People are saying it is not a “final solution” but rather an ugly hack or workaround. I do not agree, but someone might be looking in on this site.

  6. Glad

    how to Set up your PATH variable to point at the SDK???

Comments are Closed

The opinions expressed on this website are those of each author, not of the author's employer or of Red Hat. Fedora Magazine aspires to publish all content under a Creative Commons license but may not be able to do so in all cases. You are responsible for ensuring that you have the necessary permission to reuse any work on this site. The Fedora logo is a trademark of Red Hat, Inc. Terms and Conditions