It’s just so much information so dense and it’s enough to put a lot of people in before they start. My goal with this article is, therefore, to provide an accessible guide to try to make the whole prospect of creating an application a little less daunting … I’ll explain the things you need to know and review the rest and in the end, you should have a basic application that you can start to browse and experiment with.
Go make yourself a cup of tea first, it may take a while …
Step 1: Download Android Studio
The great thing about Android Studio is that it’s specifically designed for Android development (unlike the second most popular option, Eclipse). This means that when you download the software, you also get a lot of the other elements you need, including the Android SDK (a selection of tools including the Android platform) and the Android virtual device, an emulator that you can test your apps on. When going through the installation, be sure to leave the boxes checked to confirm that you want these additional components. You can add them manually later, but that will only complicate things.
If you read all this and find it too much, you can consider Basic4Android as a simpler approach and I’ll cover that in a future post.
Ok, just to recap: we now have Android Studio downloaded and installed. But, do not run it until you read step two! So far so good … What could go wrong?
Step 2: Setting up Android Studio
Now that you’ve installed Android Studio, you’ve taken your first bold step to becoming a developer! Many people only care about it so far and leave the software installed on their computer for months, feeling guilty every time they see it in the Start menu. Eventually, they finish deleting it to make room for the next AAA title on Steam and so ends the whole thing sorry … Do not end up like them – it’s time for a more affirmative action!
Before you can start, you must also install Java on your Android machine. Specifically, you will need the Java Development Kit (JDK). Java is the programming language you will use in your studio and you must install it on your computer. understood by the CPU – machine code). You will find the Java Development Kit here. Just download and follow the instructions to install.
You can now click on Android Studio to launch it. Once it opens, you will be presented with a menu where you will be able to start or configure certain options. What’s great is that everything is managed for you, but you can get started with the SDK Manager (Configure> SDK Manager) where you will update your Android SDK to support newer versions, download Code samples or Google Glasses. But Android Studio says you’re missing something, that’s where you’ll probably find it.
There are so many things you need to know when using Android Studio to build your apps.
Step 3: Start a new project
Once your samples are installed, you can access Android Studio. Now you want to choose to Start a new Android Studio project – it’s finally here!
Enter the name you want for your application and your “corporate domain”. Together, these elements will be used to create your package with the following format:
The package will be compiled or APK (Android package file) that you will end up downloading on the Google Play Store. There are ways people can see this, so you intend to do something you’ll end up publishing, try not to use “funny words”.
Choose the name of the package
The last field to enter is the directory where you want to save all files related to your application. I like to save in DropBox to make sure I always have a backup of my code. Click Next again and guess what … More options! Huzzah! Do not worry, we are almost there …
Then you have to decide what type of device you are going to develop and in this case, we will start with the Phone and Tablet option. Other options are TV, Wear, and Glass. It’s good if you want to develop for a myriad of platforms in the future – that’s one of the wonders of Android – but let’s start with something a little easier to start with, okay?
The other choice you need to make at this point is the ‘Minimum SDK’. This is the lowest version of Android that you want to support. Why not just enter the latest version of Android here? Well, because relatively few people have the latest version of Android installed on their device at any given time. You want to support phones that are still running older versions to reach the widest audience possible, especially overseas.
Choose an activity
Keep in mind that an application can have multiple activities that act as separate pages on a website. You can have a “settings” activity for example and a “main” activity. So the activity is not the application for example, but rather a stand-alone page of your application.
For your first creation, however, you will probably do better to create something really simple that simply displays a single basic activity. Select “Basic Activity” to keep things as simple as possible and for all practical purposes, this will now be your application. Click Next, you get the latest options.
The disposition name describes a file that determines the disposition of an activity. This is a separate piece of code that works in conjunction with the main activity code to define where things such as pictures and menus and the fonts you use will go. It’s actually not Java but XML – or Extensible Markup Language if you want to impress your friends.
Step 4: Do a real thing
Once your application is open, you should see a directory tree on the left with all the different files and folders that make up your application and an image of a phone displaying “Hello World!” In the center. Well, hello to you too!
(A basic application that displays “Hello World” is what most new developers do first when they learn to program in a new language. Android Studio cheats, however, because it does it for you!)
You may notice that the open tab (top) is ‘activity_main.xml’, which shows the big phone on its screen. You can remember that activity_main.xml is the XML that defines the layout instructions for your main activity.
If you selected ‘Basic Activity’ when starting your project, a second XML file is named ‘content_main.xml’. Essentially, these two do the same thing but the file “acitvity_main.xml” contains the basic layout created by Android Studio when you selected “Basic Activity”. The content you want to edit is contained in content_main.xml, so open it and do not worry right now.
(If this is not what is open at startup, use the directory on the left to open it by choosing: app> res> content_main.xml.)
Step 5: How to improve application development
Okay, it was a lie. We will probably not be rich. At this moment, the application we have done is quite lame. You can try and sell safe but you probably will not get many good reviews.
The reason I talked to you through this basic application creation is that it teaches you the fundamentals of programming. You have an action and a reaction – pressing a button does something. Throw a few variables and some maths, add pretty pictures and a useful function and it’s really enough to make a very basic application.