How to Install and Setup Android Studio ?




Android Studio is the Google’s Officially Supported IDE for android that provides fastest tools for building apps on every types of Android device. It is based on IntelliJ IDEA, and is freely available under Apache license. The recent version includes following features.

a. A common platform to develop android applications for all android devices.
b. You can also build android TV and Android Wear apps.
c. Template-based wizards to create common Android designs and components.
d. It supports gradle-based android applications development.
e. A fast and feature rich emulator.
f. Support for Instant Run to push changes to your running app without building a new APK.
g. C++ and NDK support.

1.1 System Requirements for installation

Google provides Android Studio for windows, Mac OS, and Linux platforms. Before downloading Android Studio, make sure your device meets one of the following requirements

Windows OS

a. Microsoft® Windows® 7/8/10 (32- or 64-bit)
b. 3 GB RAM minimum, 8 GB RAM recommended; plus 1 GB for the Android Emulator
c. 2 GB of available disk space minimum,
d. 4 GB Recommended (500 MB for IDE + 1.5 GB for Android SDK and emulator system image)
e. 1280 x 800 minimum screen resolution
f. For accelerated emulator: 64-bit operating system and Intel® processor with support for Intel® VT-x, Intel® EM64T (Intel® 64), and Execute Disable (XD) Bit functionality

Mac OS

a. Mac® OS X® 10.10 (Yosemite) or higher, up to 10.12 (macOS Sierra)
b. 3 GB RAM minimum, 8 GB RAM recommended; plus 1 GB for the Android Emulator
c. 2 GB of available disk space minimum,
d. 4 GB Recommended (500 MB for IDE + 1.5 GB for Android SDK and emulator system image)
e. 1280 x 800 minimum screen resolution

Linux OS

a. GNOME or KDE desktop
b. Tested on Ubuntu® 12.04, Precise Pangolin (64-bit distribution capable of running 32-bit applications)
c. 64-bit distribution capable of running 32-bit applications
d. GNU C Library (glibc) 2.19 or later
e. 3 GB RAM minimum, 8 GB RAM recommended; plus 1 GB for the Android Emulator
f. 2 GB of available disk space minimum,
g. 4 GB Recommended (500 MB for IDE + 1.5 GB for Android SDK and emulator system image)
h. 1280 x 800 minimum screen resolution
i. For accelerated emulator: Intel® processor with support for Intel® VT-x, Intel® EM64T (Intel® 64), and Execute Disable (XD) Bit functionality, or AMD processor with support for AMD Virtualization™ (AMD-V™).

At this point, we are assuming that you have device that fulfil one of the above requirements. Now, Let’s Install the Android Studio. Here, we are showing example to install android studio in Windows OS. However, you can install it similarly in other platforms as well.

1.2 Installing Android Studio

Before starting, check whether you have installed correct JDK version or not. In Mac OS, To check java version, open Launchpad and type terminal. Then, select Terminal when it shows up. Now, type javac -version

Tutorialwing - Check Java Version installed

Tutorialwing – Check Java Version installed

If you are not seeing screen similar as above, it means you have not installed Java properly. Goto this link. Then, download and install current java version.

Now, Start installing the Android Studio.
Goto to this link to download android studio. Choose your platform and click on the related android studio download link. Then, Accept the link and click on DOWNLOAD… link.

Tutorialwing - Android Studio Download

Tutorialwing – Android Studio Download

Then, follow the procedure as shown below to install the Android Studio.

Tutorialwing - Android Studio Install Step-1

Tutorialwing – Android Studio Install Step-1

Now, Select the components you want to install.

Tutorialwing - Android Studio Install Step-2

Tutorialwing – Android Studio Install Step-2

then, Accept the license.

Tutorialwing - Android Studio Install Step-3

Tutorialwing – Android Studio Install Step-3

Choose Android Studio installation location and Android SDK installation location. Then, click next.

Tutorialwing - Android Studio Install Step-4

Tutorialwing – Android Studio Install Step-4

Choose the start menu option folder and click next.

Tutorialwing - Android Studio Install Step-5

Tutorialwing – Android Studio Install Step-5

Tutorialwing - Android Studio Install Step-6

Tutorialwing – Android Studio Install Step-6

After successful installation, You will see the screen as below. Click next.

Tutorialwing - Android Studio Install Step-7

Tutorialwing – Android Studio Install Step-7

Then, check the option to Start Android Studio and click finish button.

Tutorialwing - Android Studio Install Step-8

Tutorialwing – Android Studio Install Step-8

That’s it. Android Studio is successfully installed now.




1.3 First Time Android Studio setup

When you will open android studio for the first time, you will see the welcome screen and some first time setup screen.

Tutorialwing - Android SDK component setup step-1

Tutorialwing – Android SDK component setup step-1


Clicking next in the welcome screen will redirect you to the next screen. You will see 2 options there. If you want to install the sdk component manually, you can select Custom. Otherwise, you select Standard. Most of the things will be automatically done on behalf of you.
Tutorialwing - Android SDK component setup step-2

Tutorialwing – Android SDK component setup step-2

Then, Select the options you want to install. Then, Click next.

Tutorialwing - Android SDK component setup step-3

Tutorialwing – Android SDK component setup step-3

Clicking finish button will start installing the components you have selected. So, make sure you have selected what you want to install. You can also go back and change your selection.

Tutorialwing - Android SDK component setup step-4

Tutorialwing – Android SDK component setup step-4

Tutorialwing - Android SDK component setup step-5

Tutorialwing – Android SDK component setup step-5

On complete installation, you will see the screen as below. Click finish and you are done.

Tutorialwing - Android SDK component setup step-6

Tutorialwing – Android SDK component setup step-6

1.4 Android SDK Manager

Each version of android has its own SDK(Software development kit). SDK provides the ability to create an application for that version. e.g. If you have installed SDK for Android Lollipop, you can create android application for Lollipop version. Similarly, you need to install the SDK for all the versions in which you want to create the android applications. Now, Since you just went through the setup wizard, you will already have the latest version installed.
However, you can install the new SDK as mentioned below.

Installing a new SDK

At first, open Android Studio and look for the icon to open Android SDK manager. It’s in the top menu section as shown in the below image. Clicking on the menu icon will pop up SDK manager. However, there is a option to open a standalone SDK manager.

Tutorialwing - Android Studio, SDK manager

Tutorialwing – Android Studio, SDK manager

Click on the Launch Standalone SDK manager. A standalone SDK manager will be popped up. There you will see all the SDKs available till date. You can also see how many SDKs you have installed, how many SDKs you have not installed, whether there is any update available for already installed SDK etc. You can also select a new SDK and click on the install package button.

Tutorialwing - Android Studio, SDK manager Standalone

Tutorialwing – Android Studio, SDK manager Standalone




1.5 Creating New Project

Since we have completed setup. Now, we will create a new project and run on emulator as well as on device. When you will open Android Studio, you will see the screen as below. Here, you will see the many options. e.g. option to create a new project, to open an already existing project, import project, download project from version control(Github, Gitlab etc.) etc. In this tutorial, we will create a new android project. So, select Start a new Android Studio Project.

Tutorialwing - Android Studio New Project Step-1

Tutorialwing – Android Studio New Project Step-1

Clicking on Start a new Android Studio Project options will redirect you to the new screen. Here, you need to provide following things –
a. Application Name: application name of your choice. e.g. HelloWorld, First Project etc.
b. Company Domain: Your company domain. Again, you can put any domain name. Also, notice that as you type, Package Name automatically changes based on the entries in Company Domain.
c. Package Name: This uniquely identify the application. This is generally in the form of com.organizationName.appName – all lowercase and no space. Note that package name starting with com.example is not allowed in play store. So, if you want to upload apk file, you need to remove ‘example’ word from the package name. e.g. com.tutorialwing.appName etc.
d. Project Location: You can choose project location where you want to store the project in your hard disk.

Then, click next.

Tutorialwing - Android Studio New Project Step-2

Tutorialwing – Android Studio New Project Step-2

You will be redirected to next screen where you will have to select target devices for which you are creating this application. You need to select Phone and Tablet if you are creating this application for mobiles and tablets. or if you are creating this application for TV, you need to select TV. Similarly, you can select any option. Now, after selecting target devices, you need to select minimum SDK. Suppose you have selected minimum SDK as 16. It means your application will be used on the device which has either android OS version 16 or above. Let’s take an example to understand it clearly. Suppose you have selected Phone and Tablet and minimum SDK as 16. It means your application will run on phone and Tablet that has android OS version either 16 or above. The main point to notice here is that how will you choose the minimum SDK. The solution is You check how much target audience will be covered with the selected minimum SDK. After selecting minimum SDK, a rough idea of the audience being covered is shown below the selected minimum SDK. you can take better decision based on this data.
After selecting target devices, click next.

Tutorialwing - Android Studio New Project Step-3

Tutorialwing – Android Studio New Project Step-3

Now, you will be redirected to the screen where you will see different Activity option. Each option has a unique feature. Some contain Floating Action button with activity, some contain simple activity, some contain google map etc. Suppose you need to show Floating Action button, you can select Basic Activity that has already implemented floating action button in Activity. Similarly, you can select any activity based on your requirement.
After selecting Activity, click next.

Tutorialwing - Android Studio New Project Step-4

Tutorialwing – Android Studio New Project Step-4

After selecting activity, you need to provide Activity name and it’s layout name(if you want to create a layout file for this activity). Here, we have given it’s default name i.e. MainActivity and activity_main.
Activity Name: This is name of your activity. A .java class will be created that refers to your activity.
Layout Name: UI that is shown in activity is defined inside this layout file.
Then, click on finish button.

Tutorialwing - Android Studio New Project Step-5

Tutorialwing – Android Studio New Project Step-5

After clicking finish button, Android Studio does a lot of behind-the-scenes operation and creates the application. This is your initial project structure.

Tutorialwing - Android Studio New Project Step-6

Tutorialwing – Android Studio New Project Step-6

That’s it. Your project is successfully created.
Now, you need to run it. You have 2 options to run this application.
a. On Emulator
b. On Device.

1.6 Running Android Project into Emulator

Emulator is software based Android Device on computer in which we can run, debug any application, or can browse websites or can do anything that is expected from a simulator. This is actually a replica of actual android device.

You can create emulator of specified target, version, screen resolutions etc. Let’s create an emulator now to run the application.

Creating an Android Emulator

Click on AVD manager option, shown at top menu option.

Tutorialwing - Android Studio Create Virtual Device step-0

Tutorialwing – Android Studio Create Virtual Device step-0

When AVD manager opens, you will probably see the default emulator and few details about it. You can also create a new virtual device. If there is not any default emulator, you will see screen as below.

Tutorialwing - Android Studio Create Virtual Device Step1

Tutorialwing – Android Studio Create Virtual Device Step1


Then, click Create Virtual Device

Then, you will be redirected to a screen where you will have option to select category of which you want to create emulator. Also, you can see the device name, size and screen resolutions. So, based on your requirement, you can select proper device.
Then, Select Nexus S and click next. However, you can select any device.

Tutorialwing - Android Studio Create Virtual Device Step2

Tutorialwing – Android Studio Create Virtual Device Step2

Select Marshmallow and click next.

Tutorialwing - Android Studio Create Virtual Device Step3

Tutorialwing – Android Studio Create Virtual Device Step3

Now, you will be redirected to Verify Configuration screen where you will see the details of the emulator you are going to create. If everything is OK, click finish.

Tutorialwing - Android Studio Create Virtual Device Step4

Tutorialwing – Android Studio Create Virtual Device Step4

You will see the new device created in the list.

Tutorialwing - Android Studio Create Virtual Device Step5

Tutorialwing – Android Studio Create Virtual Device Step5

Since we have an emulator now. So, run the application.

Running application

Click on the Run button. Then, choose emulator and click on OK button.

Tutorialwing - Android Project Run app

Tutorialwing – Android Project Run app

Then, you will get the output as shown below.

Tutorialwing - Android First Project Output

Tutorialwing – Android First Project Output

1.7 Running Android Project into Device

To Run Android Project into device, you need to make sure that Developer mode is enabled. This is step by step process to enable Developer mode.
a. Go to Settings on your device.
b. Scroll all the way down and select About phone.
c. Scroll to Build number and tap in multiple times. You’ll see a toast come up that states “You’re n steps away from becoming a developer”. Keep tapping and it will change to “You’re now a developer!” once it’s enabled.
d. Go back to Settings screen and scroll all the way to the bottom. You’ll now see Developer Options enabled.
e. Select Developer Options. Next, turn on the USB debugging switch under the Debugging section.
f. Connect your device to your computer via USB.
g. You’ll now be prompted to confirm this option via a dialog that states Allow USB debugging? — click OK.
h. Next, you’ll be asked to register your computer’s RSA key fingerprint. If this is a trusted machine, then check the Always allow from this computer option.
Now that you’ve configured your device, click the Run button.
After this, you will see a device chooser screen. You will also see the connected device. Select the device and click OK. You will see the output as shown below.




Output
Tutorialwing - Android Project Mobile Output

Tutorialwing – Android Project Output

Conclusion

Android Studio is the Google’s Officially Supported IDE for android that provides fastest tools for building apps on every types of Android device. It is based on IntelliJ IDEA, and is freely available under Apache license. In this tutorial, basic things about creating and running a new project has been covered. Later on, we will cover some more concepts about android studio. However, you can check out other tutorials as well. Hope this tutorial helped you.

Support Us

If you have any suggestion about this post, please comment below. We are looking for someone who helps use to make our tutorial better. Also, If you want tutorials on any topic, you can mail us at tutorialwing@gmail.com. We will try to cover the topic as soon as possible. Connect with us on Facebook, Google+, Twitter and Youtube for more updates.