Click here to Skip to main content
15,884,986 members
Articles / Mobile Apps / Android

Launch Your Android App: Intro & Getting Started (part 1 of 3)

Rate me:
Please Sign up or sign in to vote.
4.67/5 (8 votes)
9 Feb 2016CPOL16 min read 17.7K   20  
Start your Android Development with a detailed look at Android Studio installation.

Article Notes

This article contains the first two chapters (introduction & first chapter) from my forthcoming book, Launch Your Android App.

I've included both chapters in this article because the introduction would not add a lot of value as a standalone article.

If you scroll down quickly through this article, you will quickly see that it is quite long.  That's because it includes 42 screenshot images.  

Walk-Through Experience

I am writing the book as a walk-through in an attempt to create a better information product.  I am hoping that this method will allow you to read and experience development as if you are looking over an Android developer's shoulder.  

I believe this will be an effective way of covering the intense subject of Android Development.

Attempt At Creating A Hybrid Format

This is somewhat of a hybrid format of a video tutorial merged with a book.

What Am I Attempting to Solve With This Format?

It's an attempt to solve the challenge of reading a book and needing to type code to see the results.  Instead, here you will be able to focus on reading and experiencing the code as if you are looking over an Android developer's shoulder the first time.  Then, after reading the chapter, it will be far easier to go and write the code yourself only briefly referring back to the book.

Is There Value Added?

I believe, even if you are an advanced developer you will find the walk-through quite interesting, because you can simply skim through the article (and book) as a preview of what you will see when you sit down and work with Android Studio.

I hope you find this enjoyable.   Here are some more details of the book provided in my introductory chapter.

Introduction

What will Launch Your Android App cover?

<meta charset="utf-8" />

Everything from installing Android Studio through deploying your Android app to the Google Play store.

 

Learn As You Read

Read the book and see every screenshot you’ll encounter as you actually develop your app.  Then, when you sit down to write your own app you will speed through development.

Focus On Running Apps

The main focus is on getting your App running. You will learn how to develop Android apps, but we will always focus on running your app on emulators and devices.  Deploying code to devices and emulators requires a few tricks and this book will empower you to be able to deploy to those devices so you can see your app run everywhere.

Android Development Core Concepts

You will learn all of the core concepts that Android is built upon.

You’ll learn layouts (User Interface design). Lot’s of challenges.

You’ll learn about Activities (the screens or forms) where your app code runs which make up your application.

How to start and use Intents (built-in functionality which enables you to retrieve web pages, make phone calls, vibrate the device and much more).

Why Learn Android Development?
There are numerous reasons to learn to create your own Android apps.

  1. As an introduction to the programming world.  Maybe you are interested in what programmers do and you would like to know if it is something you’d like to do.  This book will make a great introduction for those who are starting out.

  2. For personal pleasure - hopefully you are interested in seeing your own creations become real.  You can write your own apps, run them on your phone and give them to all your Android-friends.

  3. To create your own apps.  Maybe you want to create a solution with an app that you can’t find -- at least a reasonably good version that you trust.

  4. To build a career (to make money) Android devices (phones, tv, wearables) are everywhere.  Literally 100s of millions of devices out there.  The person who knows how to  create Android apps will likely have many opportunities to earn a living

How Will This Book Work?

No matter what level you are at, you will learn the essential skills and understand the code you need to create your first Android application while reading this book.

However, even if you’re already a developer this book will help you.

Here’s why this book can be read both by advanced developers and the very newest beginners.

Focus: The Final Running App

As I said earlier, this book always targets the working / running app as the goal.

That means we will write applications that automate interesting activities and run.

Advanced Developers

The code will be explained as we go, so if you are an advanced user and you understand how the code works you won’t be held back from skimming the code, building and running the app.  You can focus on the parts you need more information about.

Beginners

However, if you are a beginner and need more explanation, read the details that explain the more difficult parts so that you understand what the code does before moving on.

Beginner Help Extras

Instead of slowing down the more advanced developers with the extras which explain the small details, I will provide supplementary material that will provide extra examples and explanation for items which may overwhelm the newer programmer.  These will be kept out of the way for advanced devs but easily accessible for beginners.

Book Structure 

I will also do some organization work which will break the content into chapters that cover specific topics  so that if a person understands the material in the chapter she can skip it and move directly to the material which better meets her needs.  

Throughout the narrative, Launch Your Android App will always focus on writing code and building apps, because that is how you actually learn to program.

The Power of the Write, Build, Run Loop

You will learn to code when you write, build and run code.

Each of these steps offers it’s own challenge.

Write Challenge

Can you type the code that will compile?  Do you understand the syntax of the commands? Do you know how to instantiate an object in Java?  Do you know how to access the library which contains the functionality you need?

Build Challenge

Does the code compile?  Is the code valid?  If not, what do you do?  How do you understand what Android Studio is telling you to change?  One of the most powerful abilities in the programming world is the ability to understand the errors you are seeing and knowing how to get the errors to go away.  You will learn to do this here.  Gradle (Java build system) is a huge part of Android Studio and may drive you crazy.  We’ll learn how to control it and what to do when it fights us.

Run Challenge

Can you deploy the app somewhere (emulator or device) to get it running.  Android apps cannot run on your windows or linux box.  You have to deploy them.

Does the program crash before you even see the main Activity (form)?  Does it crash immediately after you click the only button on the form?  Does your program crash for some unknown reason when you attempt to get data from the Internet?  These are logic errors within your code that are probably based upon your lack of understanding about how the components and functions you have built upon work.

All Three Challenges

The point of all these three challenges is that you must write, build and run code to learn how the entire Android App ecosystem works.  The more you go through those challenges the more you will become familiar with the errors that may occur.  The more you become familiar with the errors that may occur the more likely it is that when you get stuck in an odd situation you will be able to figure out how to get your app written, building and running again.

Large Number of Android Apps In This Book

That’s why we will focus on a large number of apps in this book. Many of those apps will be small to prove a point in code, but they will also test you through the three challenges we just mentioned (Write Code, Build, Run).

Complete Apps

We will also finish at least 5 fully developed applications and deploy them to the Google Play store.

Note: More details will be provided on the 5 applications as the book becomes ready for publicatoin.

This will take you through the complete development cycle of an Android app and provide you with validation that if you finish the book, you will be a professional app developer.

Blast Off!

I’m interested in writing code, building and running it so I’m not going to tell you the history of Android or Android Studio or anything else.  Instead, I’m going to walk you through how to get Android Studio (Version 1.5.1 as of this writing), install it and generate your first program.

Let’s go!

The Dream: Button-click Installation

I wish I could let you click a button on a web page at my site and everything you need to develop Android apps would be installed on your computer.  However, that is just a dream.  Everyone’s computer is different -- running various versions of each (Operating System) OS, etc. so it’s just not possible.

Installation Knowledge Not Wasted

However, the knowledge you gain even while simply installing Android Studio and the supporting tools is all part of your learning. In other words, simply installing the development environment is valuable to you as a developer.  Keep that in mind as we move through these steps and I’ll try to reveal some extras that you may not have noticed that will become important to you later when you’re developing your apps.

Get Android Studio

Android Studio is free from Google and you can get it at:

http://developer.android.com/sdk/index.html

Installation Requirements

There are some hardware and Operating System requirements.

You have run it on a Mac, Windows or Linux system.

Since Android Studio consumes quite a few resources (memory and CPU) on your machine, the faster the machine you have and the more memory you have the better.

Emulator Eats Your Computer

Also, at times we will be running an Android emulator on our development computers.  That emulator is basically the Android OS running inside your computer.  That means it will be borrowing your CPU and memory also.  

As of 2015-02-05 here are the basic requirements (straight from the Google site) so you will know what you need:

  • Microsoft® Windows® 8/7/Vista (32- or 64-bit)

  • 2 GB RAM minimum, 4 GB RAM recommended

  • 400 MB hard disk space

  • At least 1 GB1 for Android SDK, emulator system images, and caches

  • 1280 x 800 minimum2 screen resolution

  • Java Development Kit (JDK) 73

  • Optional for accelerated emulator: Intel® processor with support for Intel® VT-x, Intel® EM64T (Intel® 64), and Execute Disable (XD) Bit functionality

*1. Mine is at 1366x768 (below recommended width) and I don’t experience any problems.

*2. At least 1 GB - that’s because for each version of Android OS you install (Jelly Bean 4.1.1, Jelly Bean 4.1.2) you are installing an entire OS again.  It takes a lot of space and they’re trying to warn you.

*3. JDK 7 : Android code is written in a subset (and superset) of Java so you need the Java Development Kit.  Notice that as of this writing, you still need the older version 7 (instead of the newer version 8) since Android doesn’t support version 8 yet.

Begin Android Studio Installation

Go to the Android Studio web (Google's Android Developer web site) site and download Android Studio installer.

http://developer.android.com/sdk/index.html

get android studio

You will have to accept the terms and conditions.

terms & conditions

Save it on your local drive.

save to local drive

You will see the file downloading in your browser.  Here's what it looks like in Chrome.

chrome download

You can see that the download is 1.1GB so it might take a while, depending upon your Internet speed.

large download

You can click "Open" or you can go to the folder where you downloaded the installation package and double-click it.  The installer will start extracting.

start installation

When it is fully extracted, UAC (User Account Control) will (may) warn you about installing apps.

UAC warn

Finally, the Android Setup is running.
setup is running

If you do not have a JDK (Java Development Kit) installed you will see a message like the following:

java warning

I clicked that link and it took me to the following page:

java1

You will need to scroll down that page until you see something like the following:

java2

The first list with the heading, Java SE Development Kit 7u79, is the one we want.  Notice there is a radio button to "Accept License Agreement".

This isn't exactly the easiest web page to understand.

Click the "Accept License Agreement" radio button and choose:

Once you click that, the header will change so it looks like:

java3

Now you can click (way over on the right) the JDK for your OS.

java4

I am running a 64-bit Windows 10 OS on an Intel 64 bit processor so I choose x64.

When you click it, Windows will help you so you can save the JDK download on your file system.

file explorer

Remember the location, because we are going to have to start up the installation package after downloading it.

Again, in Chrome when you download the JDK it'll look something like the following at the bottom of the browser:

small message

Once you open the installer UAC (User Account Control) is going to verify that you really want to allow the executable to run.

UAC2

Click the [Yes] button.

You'll see something like the following:

java jdk

And very quickly after that, you'll see:

jdk3

Click the [Next] button to start the installation and you'll see:

jdk4

I'm just leaving everything to install in the default location.  You can see it will go to c:\Program files\ which is the x64 Windows default.

Click the [Next] button.

You'll see something like the following:

jdkInstall

And then, it'll ask you again if the default location is okay for the JRE (Java Runtime Environment).

The JRE is the Virtual Machine which Java apps actually run inside.

You can install the JRE without installing the JDK since the JRE allows Java apps to run.  Many end-users only have the JRE because they only run programs, but never write Java applications.  We are installing the JDK (Java Development Kit) because we are developing apps and need the tools it provides.

 

The default is fine.  Click the [Next] button.

You will see something like the following:

jdk5

Finally, it will complete and you will see something like:

jdk6

You can just click the [Close] button.

Now, we need to make our way back to the Android Studio installation.  It's still running, because it was waiting on us to install the JDK.

You should see an icon on your taskbar for Android Studio, which looks like:

studio icon

Click the icon and the installation screen should come back up.

jdkcomplete

It says, we can just click the [Next] button (since we've installed the JDK) so let's try that.

You will then see the following:

studioInstall

Take time to notice a couple of things on this dialog.

First of all it will intall three things on your computer:

1. Android Studio

2. Android SDK (software development kit)  -- these represent the various versions of Android that have been released.

3. Android Virtual Device (AVD) -- this is the emulator and Android OS files for different versions of the Android OS so you can run the emulator as if your are running any version of Android on your computer.  This is how we test our app on multiple Android devices.

Click the [Next] Button.

A license agreement will appear so you can read what you are agreeing to.

studio license

Click the [Agree] button so you can continue.

The location where Android Studio will be installed and separately where the Android SDK will be installed is shown.

studio path

Again, I'm accepting the defaults so click the [Next] button.

You will see the final dialog telling you about the shortcuts (icons) it will install so you can start Android Studio.

studio icons

Again, I accept the defaults so click the [Install] button.

It will begin to install and display files it is adding:

studio installing1

If you click the [Show Details] button it will show you something like the following:

continue install

It was very fast but slowed down tremendously when it was doing the following:

studio extracting

It was extracting the Android SDK

Then I could see that it was installing the Android SDK:

cont studio 3

That's over 3.6GB of files extracting and so it took a while.

Finally, it completes and you will see the following :

finished extracting

Click the [Next] button

studio splash 1

Click the [Finish] button and we can finally start up Android Studio.

You will then be prompted about importing settings from a previous version of Android Studio.

I thought this was a bit odd since I didn't have any previous version installed.  Then I saw the last radio button choice and I selected it and clicked [OK].

The following splash screen showed up and that thin green line is actually a progress bar.  

main splash

When the progress bar finally got to the far right of the splash screen a new window popped up.

welcome window

Click the [Next] button to validate that your installation is correct.

The following window will display:

install type

sidebar: You really have to wonder about the graphic / UI designers who created these installation screens.  They are huge with so little information on them.

Click the [Next] button to accept the default settings for Android Studio.

Since you are a new user you will need to learn more about the system before you have a good idea about how to customize Android Studio.

 

The next window provides an overview of the additional tools and SDKs it is going to download and install and the path where it will install them.

verify settings

Click the [Finish] button to allow the installation to continue.

downloading components

If you clicked the [Show Details] button, when it finally completes you will see an entire list of everything it installed and the [Finish] button will be enabled so you can click it.

finished downloading components

At the bottom you can see that informs you that the "Android SDK is up to date."

Click the [Finish] button.

Finally, Android Studio is actually ready to run.

You will now be able to choose to "Start a new Android Studio project".

Studio is installed

Now we can go ahead and start a basic test project to make sure it all works.

However, since this chapter has been extremely long with so many screenshots I’m going to move us to chapter two so that our first project is created separately to make it easier to skip this chapter on installation for those who’ve already done all that.  

Coming Soon : Chapter 2 

In chapter two, we’ll start off, right where we stopped here.  

See you there.

History

First release of this introduction and chapter 1: 2016-02-09

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior) RADDev Publishing
United States United States
"Everything should be made as simple as possible, but not simpler."

Comments and Discussions

 
-- There are no messages in this forum --