Recently I had to write an Android app and I followed the official Android app development guide at http://developer.android.com/training/index.html
Here in this post, I intend to write down the steps I followed, issues I came across and how I did overcome them. I followed the approach of downloading the SDK separately and integrating eclipse with it, because I needed to use it with some other IDE too. You also can follow the other approach where you can download the ADT bundle which has an Eclipse IDE with built-in Android Developper Tools.
Step 1: Installing Android SDK
Download the Android SDK from http://developer.android.com/sdk/index.html and unzip it to a location of your choice.
Change directory to [android_sdk_home]/tools and run ./android. This starts the Android SDK Manager through which you can install the platform tools, APIs etc. Check and install the necessary artifacts as shown below:
While installing, you might come across an error saying: "Stopping ADB server failed (code -1)", after the first installation completes, you might need to re-run the Android SDK Manager following the same steps above and the above error will not occur during the installation. It is important that you get rid of that error because it causes problems while you run the program later.
Step 2: Setting up the IDE
I used eclipse for my first app and you can setup eclipse for Android application development by installing ADT plugin as mentioned in http://developer.android.com/sdk/installing/installing-adt.html
If the Android related options are not shown in the tool bar of eclipse once you restarted it after the installation of the plugin, go to Window->Custom Perspective->Command Groups Availability and check Android SDK and AVD Manager. Then go to the other tab in the same window: Toolbar visibility and check the same. You will see Android development options in the toolbar as shown below:
Step 3: Creating the Android Application and Running it on the Emulator
You can follow the post at http://developer.android.com/training/basics/firstapp/creating-project.html to create an Android project in eclipse and identify its main component. Then you can follow the post: http://developer.android.com/training/basics/firstapp/running-app.html in order to get to know how to run your app in an emulator.
You can read more about Android Emulator at http://developer.android.com/tools/devices/emulator.html
You have to create and run a virtual android device which is used as the emulator to run your app. You can do this via Android Virtual Device Manager which can be started either through the icon in the eclipse tool bar above or through command line, by executing ./android avd command.
If you are using a 64-bit Ubuntu version, you may get an error saying: "
In this case, you need to install ia32-libs with: "sudo apt-get install ia32-libs"
After that you can successfully create a Android Virtual Device and run your project in it by Run->Run As->Android Application in Eclipse.
Following is a screen capture of my first hello world Android App:
That's it. Hope this post helps if you too came across the same problems I did, in creating my first android app.
Here in this post, I intend to write down the steps I followed, issues I came across and how I did overcome them. I followed the approach of downloading the SDK separately and integrating eclipse with it, because I needed to use it with some other IDE too. You also can follow the other approach where you can download the ADT bundle which has an Eclipse IDE with built-in Android Developper Tools.
Step 1: Installing Android SDK
Download the Android SDK from http://developer.android.com/sdk/index.html and unzip it to a location of your choice.
Change directory to [android_sdk_home]/tools and run ./android. This starts the Android SDK Manager through which you can install the platform tools, APIs etc. Check and install the necessary artifacts as shown below:
While installing, you might come across an error saying: "Stopping ADB server failed (code -1)", after the first installation completes, you might need to re-run the Android SDK Manager following the same steps above and the above error will not occur during the installation. It is important that you get rid of that error because it causes problems while you run the program later.
Step 2: Setting up the IDE
I used eclipse for my first app and you can setup eclipse for Android application development by installing ADT plugin as mentioned in http://developer.android.com/sdk/installing/installing-adt.html
If the Android related options are not shown in the tool bar of eclipse once you restarted it after the installation of the plugin, go to Window->Custom Perspective->Command Groups Availability and check Android SDK and AVD Manager. Then go to the other tab in the same window: Toolbar visibility and check the same. You will see Android development options in the toolbar as shown below:
Step 3: Creating the Android Application and Running it on the Emulator
You can follow the post at http://developer.android.com/training/basics/firstapp/creating-project.html to create an Android project in eclipse and identify its main component. Then you can follow the post: http://developer.android.com/training/basics/firstapp/running-app.html in order to get to know how to run your app in an emulator.
You can read more about Android Emulator at http://developer.android.com/tools/devices/emulator.html
You have to create and run a virtual android device which is used as the emulator to run your app. You can do this via Android Virtual Device Manager which can be started either through the icon in the eclipse tool bar above or through command line, by executing ./android avd command.
If you are using a 64-bit Ubuntu version, you may get an error saying: "
Failed to start emulator: Cannot run program "/home/hasini/android//tools/emulator": error=2, No such file or directory
" when you are trying to run the emulator. In this case, you need to install ia32-libs with: "sudo apt-get install ia32-libs"
After that you can successfully create a Android Virtual Device and run your project in it by Run->Run As->Android Application in Eclipse.
Following is a screen capture of my first hello world Android App:
That's it. Hope this post helps if you too came across the same problems I did, in creating my first android app.