How to install Android Studio and start your very first project

installing Android Studio

Convinced Android development is for you? You need a complete development environment so you can jump in and get started. Let's go over the basic steps necessary to prepare your computer for Android development, like installing Android Studio, the Android software development kit (SDK), and the Java Development Kit (JDK). By the end, you'll be staring at a blank screen, ready to start coding and testing your apps!

Downloading the files

Remember: to code in Java on your machine, you will need to download the Java Development Kit first. We'll do that before installing Android Studio. You can find it here – you want the "Java SE Development Kit." Make sure you pick the right version and the right installation file for your operating system and your processor (most likely x64).

installing Android Studio

You can likewise get Android Studio here. Again, get the latest version and remember that this is also going to include the Android SDK and various other tools you need to get started.

Installing Android Studio

It doesn't really matter what order you install these elements in, but it makes sense to go ahead with Java first — nothing else will work without it. Having Java on our computer when we install Android Studio will also remove an extra step we'd otherwise have to go through. To get started, double click on the JDK executable and click "Next" to go through the steps. Make a note of where the JDK is installed, as this may come in handy in the future.

Installing Android Studio is just as simple. Once again, just run the setup file and then click "Next" to progress through the stages. Make sure you tick the checkbox to install the Android SDK as well as Studio. It is also a good idea to make a note of where everything is being installed in case you need it later. By default, your app might go into AppData\Local, which is a hidden folder and can cause confusion later on. If you change this to something easier to find, note that your directory isn't allowed to have any spaces in it.

installing Android Studio

The Android Studio installation process might feel a little like a lengthy and fiddly process. Don't worry, you'll never need to do it again (at least until you swap computers). Android Studio has come on leaps and bounds since the early days — the whole process is much more accessible now.

Welcome to Android Studio: Starting your first project

With that, you're in! The headache of installing Android Studio is over. Load it up, and it should all be working right out of the box. You used to have to tell Android Studio where the JDK and Android SDK were located — now it does that automatically.

Now let's go over how to set up your first project so all you'll have left to do is write!

Naming the app

To name your new project, just click the top menu and select File > New > New Project. You'll then be asked to come up with a name for your application and to add a company domain as well. The "package name" (the name of your app as the devices will see it) is made up of both these names. If you have a business, use the domain name on which your site is hosted (which will help to identify the app as yours). If not, don't worry — you can put anything in here.

If you want to call your app "Ultimate Calculator" and your business domain is "Apps Forever.com," then you might end up with a package name like "com.appsforever.ultimatecalculator." The only name that the user will ever see is "Ultimate Calculator."

Targeting the right Android version

Next, you'll be asked what kind of device you're developing for. The "Minimum SDK" is the lowest version of Android you want to support.

installing Android Studio

We'll talk more about this in future posts. For now, know that the lower the Minimum SDK, the more users will be able to try and buy your apps. If your app is going to rely on more modern features of Android Oreo for instance, you might be required to target newer versions of Android exclusively.

While installing Android Studio, you likely installed the most recent and up-to-date version of the Android SDK. Android SDKs are backward compatible, so you can support any version of Android that is lower, but you'll need to update it if you want to support something newer in future.

For now, just leave this as is, though you should remember to tick "phone and tablet." If you wanted to target watches or TV, then you would tick the respective boxes below, too.

Choosing an activity type

On the next screen, you can add an activity. Apps are made of activities — generally speaking, they are the screens you move between while using an app. Chances are you will begin your app with some kind of splash screen or UI to show the user, so you may as well add an activity at this stage. You can add activities later on, too.

installing Android Studio

There are several options here though, which include "Basic Activity," "Bottom Navigation Activity," "Empty Activity," and more.

Basic Activities are your default applications. These are the apps with most of the general recommended UI elements in place, such as the Floating Action Button (FAB). The FAB is a round button that lives in the bottom right corner of many apps on the Play Store (including nearly every app from Google). If you want to follow Google's design language (Material Design) in future, go ahead and choose Basic Activity. This introduces more code for us to deal with though, so for now I recommend you stick with "Empty Activity."

Naming your activity

Click "Next" again and you'll land on a screen where you can name your activity and the accompanying layout file, which will handle the appearance of your app and the positions of the elements. Activity files are written in Java and have the extension ".java," while layout files use XML and have the ".xml" extension. If you build a big app project, then you can eventually end up with lots of different activities, all with different names. This can get confusing, so it's important to name them logically. If no activity in your app is considered the "main" screen, you might want to change this and name it something different. For most people this is going to be just fine as it is!

first Android project

Your layout file will go into your resources folder, along with the images and sound effects you create later on. Anything in this folder is required to use lower case only. That's why the default name for your xml is activity_main.xml, while the default name for your Java file is MainActivity.java. MainActivity.java is getting around the lack of spaces by using something called "camel case" where each new word starts with a capital. Because we can't use capitals in resource files either, they need to use underscores to separate individual words. And you thought installing Android Studio was hard!

For now, you can leave these names as the defaults — Just hit "Next." You should now be looking at your very first app — congratulations!

Google has already populated this project with some code for you, so it should already function as a full "Hello World" app! If you were able to run it (which requires a little more set-up unfortunately!), you would see "Hello World!" displayed on your screen. For now, if you double click on the activity_main.xml file and then choose the "Design" view, you'll be able to see what it would look like.

Android Studio Hello World

A whole lot of different files contribute to just that single "Hello World!," as well as an awful lot of buttons and tools, which are are probably already starting to give you nightmares.

Don't worry, it's all quite simple once you know what you're doing. In a future post, we'll demystify Android Studio so you're ready to start bending it to your will and building your own apps. Now that  you've installed Android Studio and you know how to create your first app project, the first crucial step in becoming an Android developer is over!

Start Building Your Android App Today!

Android Authority is proud to present the DGiT Academy: the most detailed and comprehensive course covering every aspect of Android app development, run by our own Gary Sims. Whether you are an absolute beginner with zero coding knowledge or a veteran programmer, this course will guide you through the process of building beautiful, functional Android apps and bring you up to speed on the latest features of Android and Android Studio.

The package includes over 6 hours of high quality videos and over 60 different lessons. Reams of in-depth glossaries and resources, highly detailed written tutorials and exclusive access to our private slack group where you can talk directly to Gary and our other developers.

AA readers get an additional 65% off. That's a savings of over $160 (original price $250). Claim your discount now using exclusive promo code: 65OFF
Start Learning Now

#Google #Android #Smartphones #OS #News @ndrdnws #ndrdnws #AndroidNews

Popular Posts:

Apple is postponing new iOS features in favor of reliability and performance

Do more from your inbox with Gmail Add-ons

Google’s December 2018 security patch includes much-needed RAM management fix

Get the latest news from the Google for Games Dev Summit

17 features and tricks to help you get started with Spotify