Every app that you see on your phone is created on an Integrated Development Environment (IDE). Android Studio is the official IDE for creating Android apps. It is also the most used IDE, and most apps that you use on your Android phone are created with Android Studio.
Want to make your first Android app but holding back because you don't know how to use Android Studio? Read this tutorial to learn how to use Android Studio from scratch.
Why Is Android Studio an Ideal IDE?
- Android Studio comes with the Gradle build system and many other toolchain elements built in. This makes it the easiest IDE to set up for Android development.
- It has an excellent graphic user interface for coders, making the process of creating an app more accessible and enjoyable.
- It has a built-in emulator to make it easy to test and debug your app. It can also connect to your device for app testing.
- Android Studio allows you to create many types of apps and use several different programming languages to do so.
- It allows you to jumpstart your app with built-in templates and extensive full app templates from sites like CodeCanyon.
How to Set Up Android Studio
I know you are rather excited about creating your first app. However, you have to set up Android Studio first. It can be a little tricky sometimes to set it up; however, this tutorial has simplified the process for you so that you can set up Android Studio within a few minutes and get to making that first app of yours!
System Requirements to Download Android Studio
- if you have Windows: 64-bit Microsoft Windows 8 or 10
- if you are a Mac user: macOS® 10.14 (Mojave) or higher
- if you have Linux: any 64-bit Linux distribution that supports Gnome, KDE, or Unity DE; GNU C Library (glibc) 2.31 or later
Note that these are the basic system requirements. If you are having an issue downloading Android Studio, make sure to visit the Android Studio homepage for more details on system requirements.
Installing Android Studio
Once you've downloaded the software, it's time to install it so that it can run on your computer.
Click to open Android Studio.exe or the equivalent installer file on your computer.
Then, you will be asked to supply the JDK if you have not downloaded it separately. You can download the JDK from the Java homepage. The JDK holds all the essential tools to run a Java app smoothly.
It will then ask you to specify the installation location of Android Studio—the disk and folder where you want to keep it. You also have to pick a spot for the Android Software Development Kit (SDK) which is automatically downloaded with Android Studio.
Now you have to choose which components of Android Studio to install. All of these components are essential to make your apps, so select them all.
Time to hit Next and then Finish.
That's it! You have finally installed Android Studio and are ready to take on a project!
Your First App Project in Android Studio
The first step now is to click the button that says Start a new Android Studio project.
Now, it's time to choose your application’s name. Let’s name it MyFirstApp for this example. Then, choose a package name. This is supposed to be unique to your app alone, and it is necessary if you want to deploy your app on the Play Store. A common way to choose a unique app name is to use something like com.companyname.yourappname.
Now it's time to select the Minimum SDK, which specifies which API level you are going to create your app for. As it says beneath the Minimum SDK bar, with each API level, the features that you can use in your app increase. However, your app will run on fewer devices. The Create New Project dialog includes an estimator for the percentage of devices your app will run on.
So, if you are making an app for someone, see what their preferences are. If you are making a test app to practice, choose any API level of 19 or over because it will cater to more devices and have great features too.
Now, when you hit Next, it's time to choose the layout of your app’s initial Activity. An Activity is typically used to implement a single screen or view of your app. Let’s pick an Empty Activity so you have a clean slate to work from.
The last step is to choose your Activity’s name. I'll call mine MainActivity.
Then, it will take a moment to build the project before you enter the Android Studio code editor, where you will be able to write the code of your first app.
Understand Your Activity Screen
Once you have given your Activity a title, this is the screen that will appear. So it's important to understand what it shows.
- Toolbar: Allows you to perform common tasks in Android Studio, like building, running, and debugging apps.
- Navigation Bar: This is more specific to the project's needs at hand and, as the name indicates, it lets you navigate through the project and the currently opened class file.
- Editor Window: This is the place where magic brews. Yes, you write your code here, and the contents change when you click on different files.
- Tool Window Bar: It controls all the Tool Windows, meaning you can click on any of its buttons to expand and collapse a particular Tool Window.
- Tool Windows: These let you easily navigate and work on a specific task of your project, for example browsing files or viewing debugging information.
- Status Bar: This bar is at the bottom, showing you the status of your project. It also gives you important messages and warnings.
The Framework of the Project
Let’s focus on this area of the main Activity screen. It shows the framework of your whole project.
Every app that you write has various modules, like Android app modules, library modules, etc. Each module contains these three folders.
- manifests: Has a file named AndroidManifest.xml. This is an XML file containing the structure of the app.
- java: Contains all the files with source code.
- res: This is a short term for resources and contains all non-code resources like images or XML files like the Activity layouts.
How to Test Your App
Once you begin working on your first app, you will want to see how it displays on an Android phone. Android Studio gives you two ways to test your app and see its functioning on an actual Android device.
The first way is to connect it to your phone through a USB cable and make sure that USB debugging is on. Then, click the green button on the Toolbar, and out of the two options it gives you, click Choose a running device.
You can click on it to see how your app looks and functions on your device.
The second way is to run an emulator. If you noticed, clicking that green button on the Toolbar gave you two options. The second option is to Launch emulator. Click that.
Then, you go on to choosing the Android Virtual Device that you want the results to be displayed on. Let’s select Nexus 5X. Set the orientation to Portrait or Landscape as per your app’s demand.
It will take a few seconds to run AVD before the emulator pops up and shows you how your app runs on an Android device.
Go Ahead, Make Your First App!
You now understand how to use Android Studio. This tutorial just gave you a peek into a whole new world that lies ahead.
Now it's time to get to making that first app of yours. And the truth is, your first app is not going to be very good. Neither is your second or third. But that is how we learn and grow our skills as developers. However, I'm sure your fourth app will deserve applause!
Remember, you perfect with practice.
Start using Android Studio and take your first step towards a hit app on Google Play.
Subscribe below and we’ll send you a weekly email summary of all new Code tutorials. Never miss out on learning about the next big thing.Update me weekly
Envato Tuts+ tutorials are translated into other languages by our community members—you can be involved too!Translate this post