Developing apps for Android is one part of the cyber evolution that is empowering people across the world to improve their lives. By bringing in the open source concept on the table, Google has struck the right chord with the developers by giving the control back to community. Skill of android development once earned not only imparts you with the confidence of developing your own applications under your own name but also makes you financially strong and independent. Further, with solid support from google and communities coupled with free internet resources making Android apps have become a hassle-free learning experience. In short, Development has never been this fun and fulfilling.
But where do you start? You start right here. Getting started with android development is really easy and I am here to guide you. This step-by-step tutorial will help you set up and get you up and running with the latest tools required for you to start developing android apps in no time. With that being said, let’s begin.
1. Installing Java
1.1 Checking Version
To check the version of java on your system, type the following commands :
2. Type “run“. Select run and press enter.
This will display the version of java currently installed in your system which can now be compared with the latest version as mentioned on java’s official website page. So, if you are running the latest java, then you can straight away jump to step 2. However, if you are not, then i suggest you update your JDK by downloading and installing the recent version.
As you can see that on checking i found that i am running java version: 1.7.0_51 or 7u51 whereas the website screenshot below shows that the latest version is 8u5 which means that i need to update.
Go to Java downloads page and click on the JDK download button as highlighted in the image below.
You will be redirected to another page.
Under Java SE Development Kit, Click on Accept License Agreement.
Select the Windows x86 link if you are running 32 bit windows.
Select the Windows x64 link if you are running 64 bit windows.
Save the file and install the JDK.
2. Installing Eclipse
Eclipse is an Integrated Development Environment (IDE) required to develop android applications.
Go to the eclipse download page and within the eclipse standard edition row, click on the download link depending on your Windows version (32bit or 64 bit) as highlighted in the screenshot.
You will be redirected to the mirror selection page. Select the mirror highlighted in the screenshot below to trigger the download. After the downloading has finished, you will have a zip file. Unzip this file to get the eclipse folder. Place this folder wherever you want. For instance, I’ve put my unzipped eclipse folder in my C: directory making my path as C:/eclipse.
Now open the eclipse folder. Inside you will find the eclipse.exe file. Double-click on it to run the Eclipse editor. You will see something like this. This dialog is informing you about the location of the workspace. Workspace is the folder where all your projects, that you will work on, will get saved. Click Ok.
2.1 Installing ADT Plug-in
1. Start Eclipse
2. Go to Help.
3. Select Install New Software.
4. Click Add.
5. A dialog box named “Add Repository” will open.
6. Under “location” add: https://dl-ssl.google.com/android/eclipse/ as shown in the screenshot below.
7. Click Ok.
8. Adding the above mentioned link will display the plugins: Developer Tools and NDK Plugins. Check Developer Tools and click Next.
9. You will be redirected to the install details page showing all the packages that are going to be installed. Click Next.
10. Next, you will encounter an agreement page. Check I accept the terms of the license agreement and click Finish. This will start the download and installation of the selected plugins. Post- completion, Eclipse will prompt you to restart. Click on Yes.
NOTE: After the restart, while for some, eclipse will restart without any hassles. Some users may get a dialog box informing that the ADT plugin you just installed is of a higher version than the existing Android SDK Tools causing incompatibility issues. Click ok to get redirected to the Android SDK Manager. After it is done loading, It will prompt you to install a few packages. Install them.
3. Android SDK
Download the Android SDK from the Android SDK Download Page. Select Download the SDK button to get redirected to the license agreement page.
On the agreement page, after reading the terms and conditions, check I’ve read and agree with the above terms and conditions . Select 32 bit or 64 bit and then click on Download the SDK ADT Bundle for Windows to trigger the download.
Complete the download to obtain a zip file. Usually the name of this file is like “adt-bundle-windows-….“.You can extract this file to wherever you want. For instance I’ve placed it in C: Android SDK thereby making my sdk path as C:\Android SDK\adt-bundle-windows-x86_64-20131030\sdk.
4.1 Configuring Android SDK
1. Open Eclipse
2. Under Windows menu, select Preferences.
3. Dialog box named “Preferences” will open up. Select the Android tab.
4. Now we need to change the SDK location to redirect it to the Android SDK file we just extracted. So simply, click on the Browse button and select your extracted file. Within your extracted file, select the “sdk” folder as shown in the screenshot below and hit Apply and then Ok.
4.2 Setting Path Variable
1.Click on Start, right click on My Computer and select Properties.
2. Under System settings, select Advanced System Settings.
3. A dialog box named “System Properties” will open up. Select Environment Variables.
4. Under System Variables, Select Path as shown in the screenshot and select Edit.
5. Add the full path to the tools/ directory at the very end in the path, in my case, it is: C:\Android SDK\adt-bundle-windows-x86_64-20131030\sdk\tools; (including the semi-colon). When done, click Ok for respective windows to exit.
4.3 Creating an AVD
During development you’ll repeatedly need to test whether your app is implementing the logic correctly or not. You can do it using the android emulator or your android device. In either case you’ll need an Android Virtual Device (AVD). An AVD defines various configuration settings such as: Android SDK version, internal/external storage, back/front camera etc. that help the developer create a custom android device tailor made to his/her requirements.
1. In Eclipse, Go to Window and select Android Virtual Device Manager.
2. In the Android Virtual Device Manager Dialog box, under Android Virtual Devices tab, select New.
3. A create new AVD Dialog box will appear. Fill the following details inside it.
AVD Name: Name it whatever you want
Device : This option offers you the ability to change the emulator screen size and resolution. The purpose of this option is to let the developer see how differently his/her app will look in devices that sport different resolution and screen size. For now you can just select what I’ve selected in the screenshot above.
Target : The target is the android platform / version of the Android SDK, such as 4.4 Kitkat that you wan to run on the emulator. The Android SDK you just installed comes with a default SDK version of 4.4 Kitkat pre-installed.
Front/Back Camera : If your application utilizes a front/back camera then you can tweak these settings accordingly. For now, keep both of them as none.
Internal Storage / SD Card / Memory Options: You need not change these settings for now. However, if in the future if you are developing an application which is quite performance-centric or it requires more storage space, then you can always change these settings as per your requirements.
5. Click Ok to create your AVD.
5. Your First Android Project
After successful creation of an AVD we shall now create an android project.
1. In Eclipse, go to File, select New and select Other.
2. A dialog box will appear, select Android and select Android Application Project.
3.Fill in the project details with the following below values.
Choose the highest API level that your application work well with.
Lets you choose a base theme/look for your application. You can check all of them out one by one afterwards.
5. On clicking next you’ll be greeted by another dialog box with more project configuration options. “Create custom launcher icon” and “Create activity” should both be checked. Click Next.
6. Next you will encounter a dialog box that lets you choose a type of activity as per your requirement such as: Master/Detail Activity that lets the user view collective information with advanced navigation or a simple blank activity for simple viewing purpose with simple navigation. Check out each activity type one-by-one and view it’s corresponding picture to get a better understanding in terms of looks and appearance. Afterwards, select Blank Activity and click Next.
7. Next dialog box lets you select and customize the launcher icon for your application. In the future, if and when you create your own android application, you’re gonna make an official logo for your app as well. This is where you can implement it into the application.
9. Your first android application has now been successfully created.
10. To run your application, simply select your project from the project explorer, go to Run and select Run. You will be intimidated with a dialog box named “Run as“. Select Android Application and click ok.
Right click on the project from project explorer, select Run as, select Android Application.
Afterwards you will see a black screen of an android emulator with your application name, which will first load the android specifications you mentioned when you created your AVD and afterwards it will load your application.
Congrats! You have successfully setup an Android Development Environment on your computer and created your first Android Application. That is all in this tutorial.
If you encounter any problems during your setup or have any suggestions or you just want to drop a thanks, hit me up in the comments. Thank you and Happy Coding!
Image source: Johan Larsson, Flickr