Android : Setting up Android Stidios

In this post, we are going to install and configure Android Studios, the official Integrated Development Environment (IDE) for Android development.  It is build on the IntelliJ IDEA platform. The first question that comes to mind is Why prefer this over Eclipse+ADT bundle. Some of the resons are are follows:

  • Gradle Integration – a build toolkit that manage dependencies and allows you to define custom build logic. It also allows you to use different flavors of an application – you can define separately the development and production version.
  • Improved graphical preview – In Android Studio you can build layouts and observe changes very easily.
  • Speed – It is really fast when campared with Eclipse.
  • Android do have native support to google cloud, Junit, Maven. Yes  these are achievable via plugins in Eclipse but note that its built in here.
  • It has smarter shortcuts and better code completion support.

Lets start by downloading the it from here. Choose according to your OS. I will be using Windows. The setup is quite straight forward. During the setup you might also want to check the install HAXM also. It is intel-hardware-accelerated-execution-manager which will significalltly boost your Emulator speed.

installer

Open Android Studio to complete installation. First, it asks you to import your settings from a previous version of Android Studio. You can, specify config folder or installation home of the previous version of Android Studio. After all initialisation you will see the Welcome screen:

 

AndroidStudio_startingscreen

Before we go any further lets some of the SDK files and other components that will help in building the app and running the emulator. Go to Configure -> SDK manager

AndroidStudio_sdk0

Install the packages based on your requirement. I am installing everything under API 21 along with few of the Extra items like USB driver (to use a real phone as a test device) etc. This may take a while.

Ok, now we are set to build our first android application. Go to the welcome screen and select the Start a new Android Studio project option.

1 ) Fill in the application name, package name, and project location as as shown below. The package name is the reverse of the company domain. If you want to customize the package name, click edit on the right of Package name. The project location is where your project files reside.You can choose any location you want.

AndroidStudio_createProject0

2) Selecting Minimum SDK – It is the lowest version of Android version that your app going to support and it is usually indicated by the API level. To support as many devices as possible, you should set this to the lowest version available that allows your app to provide its core feature set. If any feature of your app is possible only on newer versions of Android and it’s not critical to the app’s core feature set, you can enable the feature only when running on the versions that support it.  The Google play will prevent the user from installing the application if the system’s API Level is lower than the value specified for Minimum Required SDK. AndroidStudio_createProject1

3) Create activity. Here you select an activity template for your app. Select BlankActivity and click Next.

AndroidStudio_createProject2

4) New blank activity. Again, just click through accepting the default settings then click finish

AndroidStudio_createProject3

Once you have clicked finished, gradle is going to build a project and you are presented with the project and all its files as shown below:

AndroidStudio_createProject4

It only displays hello world as of now and we will see teh significance of each file later on. But lets first run it on an emulator. Click the run button as shown in the screenshot above.

AndroidStudio_emulator0

You can create it by clicking the button shown above.

AndroidStudio_emulator1 AndroidStudio_emulator2

I am using Nexus 5 emulator. Once built , you can go back to the first screen and run on the slected emulator from the dropdown. It can take sometime to run the emulator.

AndroidStudio_emulator_helloworld

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: