Android development on Ubuntu / Fedora

By |

Sponsored

 

Now a days Android Rocks. Over 3 Lakhs Phones powers everyday. Over One Lakh Free Applications to download from Android Market. And Android development will became a hot topic. Android is powered By Open Handset Alliance. Compared to Iphone development Android development is less costly. Only need Android Emulator environment and Java. Eclipse IDE will do the whole work as well.

Just have a look how to setup a development environemnt in Fedora 14/ Ubuntu 10.10 for android development.

Install Eclipse IDE on Fedora / Ubuntu


Eclipse (software)
Image via Wikipedia

On Fedora you will get Eclipse Helios

yum install eclipse-jdt

On Ubuntu you will get Eclipse galileo

sudo apt-get install eclipse 

This step will take time The total eclipse is nearly 250MB to download. In Fedora DVD the Eclipse RPM is there. So just have a look before trying to download.

Install Android SDK

  • Download the SDK from http://developer.android.com/sdk/index.html
  • Unpack it in your home [/home/username] directory, then rename it to AndroidSDK
  • Add into path environment variable AndroidSDK in .bash_profile file in your home directory.
  • Fedora

    cd ~
    gedit .bash_profile
    PATH=$PATH:$HOME/AndroidSDK:$HOME/AndroidSDK/tools
    export PATH
    

    Save The file

    source ~/.bash_profile
    

    Ubuntu

    gedit .bash_aliases

    PATH=$PATH:$HOME/AndroidSDK:$HOME/AndroidSDK/tools
    export PATH

    Save the File and then

    source ~/.bash_aliases

    This will add the android sdk installation directory to the command search path of the environment variable.

    To check it just

    echo $PATH 

    will print the android path.

    Install Android Development Tools plugin for Eclipse

    • Start Eclipse, then select Help > Install new software
    • Click on the Available Software site hyperlink.
    • In Available software sites dialog, click Add….
    • In the Add Site dialog that appears,
    • enter a name for the remote site (for example “Eclipse Update”) in the “Name” field.
    • In the Location field, enter the url,

    If it is Galileo – Ubuntu

    http://download.eclipse.org/releases/galileo/

    If it is Helos – Fedora

    http://download.eclipse.org/releases/helios/


    . This will add dependency which are required for ADT plugin.

    Again click Add

    Name : Android Plugin

    source : https://dl-ssl.google.com/android/eclipse/

    • In the Available Software view, you should now in see in drop down list “Android Plugin“, select it and in box below see “Developer Tools” added to the list. Select the checkbox next to Developer Tools, which will automatically select the nested tools Android DDMS and Android Development Tools. Click Next.
    • In the resulting Install Details dialog, the Android DDMS and Android Development Tools features are listed. Click Next to read and accept the license agreement and install any dependencies, then click Finish.
    • Restart Eclipse.- This is important with out restarting you will not get the Android tools effect

    Setting up Android Virtual Device

    clcik Window > Android SDK and AVD manager.

    Screenshot of Android Emulator for SDK version...
    Image via Wikipedia

    The AVD Manager will comeup.

    goto Available packages. A set of available packes will come . Select Packages you wish to install.

    Select

    Android SDK tools revision 8

    Android SDK platform Tools

    SDK Platform Android 2-1 Update :-if you will try to develop and applicaiton for Android 2.1 – Eclair

    SDK Platform Android 2.2 Update :- if you will try to develop and applicaiton for Android 2.2 – Froyo

    SDK Platform Android 2.3 Update :- if you will try to develop and applicaiton for Android 2.3 – Gingerbird

    Documentation for Android SDK – Select if you want documentation of SDK

    Click Install Selected . then click on “accept all” and confirm with clicking on “Install”.

    This will start the component installation, when it will be done, click on close.

    Now you are ready to create a virtual device Android Emulator.

    Android Emulator is a virtual phone device inside that an Android version is running.

    Creating AVD

    This is really simple. Click Virutal Devices on left . Click new on right.

    Name : android_dev1 [Or you can choose any name]

    Target: Select a target android version from the dropdown box.

    SDCard : 62MB

    Skin : Builtin Default (HVGA)

    Then click on Create AVD

    Now You are ready for android development.

    Configure Android

    Window > Preferences >Android

    Put the Android Location : /home/username/AndroidSDK

    or just browse the location where your sdk installed.


    Android Hello world Programme

    File > New > Android Project.

    On the Create Project Dialogbox

    Project Name : HelloAndroid

    Target Name: Select Which android version like 2.1

    Applicaiton Name : HelloAndroid

    Package Name: com.example.helloandroid

    Create Activity : HelloAndroid

    Min SDK Verion : 7 (if Android 2.1 – 8 if Android 2.2)

    Then press Finish.

    Your project will be created.

    On package Explorer

    HelloAndroid > src > com.example.helloandroid

    click on HelloAndroid.java

    package com.example.helloandroid;
    
    import android.app.Activity;
    import android.os.Bundle;
    import android.widget.TextView;
    
    public class HelloAndroid extends Activity {
        /** Called when the activity is first created. */
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);
            TextView tv = new TextView(this);
            tv.setText("Hello, Android, this is the first android programme");
            setContentView(tv);
    
        }
    }
    

    Then Select Run.

    The Android Virtual Device will be initialized. The Hello Android Will be executed.

    You can Pack this applicaiton from file > Export > Android Applicaiton

    That is it. Happy Coding ……..!!!!

    Resources


    Sponsored


    Tags: , , , , ,


    comments powered by Disqus

    One Response to “Android development on Ubuntu / Fedora”

    1. Jonathanjm84

      Thanks!

    Comments are closed.