Getting started with Android Studio: requirements, installation, initial setup, and tutorials

- Andrés Cruz

En español

Getting started with Android Studio: requirements, installation, initial setup, and tutorials

As you know for a long time now that Google went from the already obsolete Eclipse with the ADT plugin to Android Studio; which is the official IDE that is based on a variant of intelligent idea and that offers us fantastic tools and possibilities for the development of Android applications.

This entry will indicate the first steps to use Android Studio, its requirements, features offered by this IDE and will also list a series of other tutorials that consist of their respective examples with which we can start in the world of Android application development.

Android Studio, our best ally for the development of Android apps

Android Studio is a powerful tool for building Android applications which should be the "norm" when developing Android applications as it already incorporates a large number of tools that Eclipse does not have (such as Android Device Monitor) or must be installed based on Eclipse. to plugins (Gradle...).

This post provides a basic introduction to Android Studio.

We will see how to install Android Studio, take the first steps, some keyboard shortcuts that you probably use in the old Eclipse with the ADT plugin and some explanations about its interface and new changes.

Requirements to use Android Studio on our computer.

Like all software, the requirements as updates are released, which in a few words means that with the passage of time, their hardware and of course software requirements increase; to date these are the requirements that are needed:

Requirements for Windows

  • Microsoft® Windows® 7/8/10 (32- or 64-bit)
  • 3 GB RAM minimum, 8 GB RAM recommended; plus 1 GB for the Android Emulator
  • 2 GB available space minimum, 4 GB recommended (500 MB for IDE + 1.5 GB for Android SDK and emulators)
  • 1280 x 800 screen resolution

Requirements for Mac

  • Mac® OS X® 10.10 (Yosemite) or higher - 10.13 (macOS High Sierra)
  • 3 GB RAM minimum, 8 GB RAM recommended; plus 1 GB for the Android emulator
  • 2 GB available space minimum, 4 GB recommended (500 MB for IDE + 1.5 GB for Android SDK and emulators)
  • 1280 x 800 screen resolution

Requirements for Linux

  • 2 GB available space minimum, 4 GB recommended (500 MB for IDE + 1.5 GB for Android SDK and emulators)
  • 1280 x 800 screen resolution

These requirements were taken from the official page that you can consult here.

Installing Android Studio

To get our copy of Android Studio for later installation, we must go to the official Android portal at the following Android Studio link and click on the Download Android Studio button:

Descargar Android Studio

Installing Android Studio on any platform couldn't be easier; in Linux we must unpack the downloaded file, relocate it to the directory we want and execute the studio.sh located inside the IDE's bin folder:

 sh studio.sh

Or if we are in Windows, we run the .exe.

From here it will launch the installer -which, as in Windows- practically configures itself; You must have an Internet connection for it to finish downloading all the modules, SDKs, support libraries, etc. It is recommended that you install the Google Play Service package once:

Instalar Google Play Service en Android Studio

In case you feel like developing in any of the APIs that Google offers such as Google Maps, Firebase Cloud Messaging among others of the many APIs that are offered through this package.

How to create a project in Android Studio

Once installed and downloaded all Android Studio dependencies we can finally start developing applications in it.

To create our first project we have to go to the top menu and then:

File >  New >  New Project 

file new project

We will be presented with a new window where we will have to indicate the data of the application that we are creating by Android Studio:

crear android app

Application name: it is the name of the application that we are going to create.
Company domain: it simply indicates the folder structure or hierarchy that the project will have, where each dot (.) is a separator; for the previous example we would have a folder tree like the following: app | dl | ko.
Project location: It refers to the location where our project will be.

By clicking on the Next button we will be presented with the selection of the SDK as well as the selection of the environment to develop, Android for phones and tablets, for watches (or wear, at the moment it does not have much of a market), for TV (it is reinventing itself , but it does not have much of a market either) among others; generally we are interested in developing for mobiles and tablets, which is the default option:

selección android sdk

In addition to being able to vary the level of SDK or support that the application will have, although we can change this at any time from the Gradle files that we define a little below.

Then we go to the feature selection part that the application to create will have, we generally leave it in Empty Activity:

empty activity android sdk

Finally, we select the name of the main activity, as well as that of the layout that accompanies it (Android application development is based on a variant of the MVC model and therefore there is a separation between the controller, which is the Activity Name with the view that is the Layout Name of the following image):

Configurar activity android sdk

And then we press Finish and with this our project will be created.

What does Android Studio offer us?

Once our project is installed and created in Android Studio we will see an interface somewhat loaded like the following; the first thing we will see is a different structure from the one we used in Eclipse with the ADT plugin both in the interface and in our project:

Interfaz Android Studio

If we go to the AndroidManifest.xml:

We will see that it is quite small and information about the configuration of the project is missing; for example, the level of targetSdkVersion and minSdkVersion -to name a few-; these configurations must now be managed from the Gradle files:

Listados de archivos Gradle en Android Studio

Gradle files are plain text files to edit the different modules, libraries and configurations to incorporate into our project.

Most of the time it is enough to edit the /app/build.gradle:

apply plugin: 'com.android.application' android {    compileSdkVersion 22    buildToolsVersion "22.0.1"    defaultConfig {        applicationId "net.desarrollolibre.dolphinaudio"        minSdkVersion 15        targetSdkVersion 22        versionCode 1        versionName "1.0"    }    buildTypes {        release {            minifyEnabled false            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'        }    } } dependencies {    compile fileTree(dir: 'libs', include: ['*.jar'])    compile 'com.android.support:design:22.2.0'    compile 'com.android.support:support-v13:22.2.1'    compile 'com.android.support:cardview-v7:22.2.0'    compile 'com.android.support:recyclerview-v7:22.2.0'    compile 'com.android.support:appcompat-v7:22.2.0' }

In which are the dependencies (modules) and part of the basic configurations of Android (targetSdkVersion and minSdkVersion).

Modules in Android Studio

Now it is easier to use libraries created by third parties that, as you can see, most of them offer the option of incorporating them through a simple dependency.

Import libraries into projects using gradle

In the following link List of Android UI/UX Libraries you can find a fairly large section of resources for Material Design, review some and you will see in the installation section links like:

dependencies {   compile 'com.github.navasmdc:MaterialDesign:1.5@aar' }

What else does Android Studio offer us?

There are quite a few interesting tools that allow us to learn more about how our apps work, which is a very useful resource for testing our apps before publishing them somewhere like Google Play; one of them is Android Device Monitor.

Android Device Monitor

So that you know how these tools work, I recommend the following video tutorials created by the people of Google:

Android Device Monitor: Lesson 2A

The tool can be found at:

Tools > Android > Android Device Monitor

We will also see that there are very useful windows such as those presented for our layouts with their design/code modality that we saw in other applications such as DreamWeaver.

Some commands of interest when migrating from Eclipse with the ADT plugins

To indent our code in Eclipse with the ADT plugins instead of using the combination of control+shift + F we must use Control+ Alt + L.

To use the Search / Replace option we must use the Ctrl + F key combination.

You can check the following entry:

 

To see a more extensive list of keyboard shortcuts.

 

To complete it is the same key combination as Eclipse Control + Spacebar.

 

Creating our device

 

Virtual devices

As it happened with Eclipse with the ADT plugins, we must have at least one device configured to test our applications from the computer; the tool in question is still called AVD (Android Virtual Device); this is one of the many features that were brought over from Eclipse with the ADT plugins; to access the AVD we must go to:

 

Tools > Android > AVD Manager

 

Physical devices

You can also use physical devices; for this we must enable the developer options on our Android device, this was already discussed in a previous post: Configuring an Android device to develop; once this is done, we connect our device and we will see a screen like the following:

Dispositivos físicos - Asus TF300

Tablet Asus TF300

 

In this way, although the process of executing an application on the device will surely take a little longer (compared to a virtual one), but the system will have fewer processes to perform because it does not have to maintain a virtual device for our applications.

 

Resources, tutorials, and examples for developing in Android Studio:

We currently have more than 78 entries in DesarrolloLibre with which you can start developing applications for Android; starting from its basic components:

Among many others that you can consult in the section corresponding to Android in our blog:

Android

One of the latest additions (or one of the most momentous) is the incorporation of Kotlin, as a programming language that we can use in parallel (or only) when developing Android applications; Kotlin has many advantages over Java for the development of Android applications, being a modern, concise language that can even be run in the Java virtual machine:

Andrés Cruz

Develop with Laravel, Django, Flask, CodeIgniter, HTML5, CSS3, MySQL, JavaScript, Vue, Android, iOS, Flutter

Andrés Cruz In Udemy

I agree to receive announcements of interest about this Blog.