To get started with Android app development, you first need to install Android Studio. Android Studio is the official IDE (Integrated Development Environment) provided by Google, offering all the tools needed to develop Android applications in Kotlin and Java. This article will detail the process of installing and configuring Android Studio.
1. Check System Requirements
Before installing Android Studio, it is important to check your system’s requirements. Below are the minimum and recommended system specifications.
- Operating System: Windows 10/11, macOS (10.14 and later), Linux (64-bit)
- RAM: Minimum 4GB (recommended 8GB or more)
- Disk Space: At least 2GB of free space (space needed for Android SDK and other tools)
- Resolution: Screen resolution of 1280×800 or higher
2. Download Android Studio
The method to download Android Studio is as follows:
- Open a web browser and go to the official Android Studio website.
- Click the “Download” button on the homepage to download the installation file.
3. Install Android Studio
To install Android Studio, execute the downloaded installation file with the following steps:
3.1 Installation on Windows
- Double-click the installation file to run it.
- When the installation wizard starts, click the “Next” button.
- On the license agreement screen, select “I Agree” and click “Next”.
- Select the components to install. By default, all components are selected.
- Select the installation path or use the default path, then click “Next”.
- Wait for the installation to complete, then click “Finish” to close the wizard.
3.2 Installation on macOS
- Double-click the downloaded .dmg file to mount it.
- Drag the Android Studio icon to the Applications folder.
- Run Android Studio from the Applications folder.
- When the “Import Studio Settings” window appears, you can choose to import settings from a previous installation. If you want to start fresh, select “Do not import settings”.
4. Initial Setup of Android Studio
After installing Android Studio, you will need to perform the initial setup on the first launch. Follow the steps below.
- Launch Android Studio.
- The theme selection screen will appear. Choose your desired theme and click “Next”.
- The SDK download screen will appear. Select the necessary SDK packages and click “Next”.
- When the screen for setting up the Android Virtual Device (AVD) appears, configure the AVD as needed. Then click “Finish” to complete the setup.
5. Check and Configure Kotlin Plugin Installation
When developing with Kotlin, the Kotlin plugin is included in Android Studio by default. However, it is advisable to check whether the Kotlin plugin is activated.
- In Android Studio, click “File” → “Settings” (for macOS, “Android Studio” → “Preferences”).
- Select “Plugins” from the left menu.
- In the “Installed” tab, find “Kotlin” and check if it is activated. If it is not activated, click the “Enable” button.
- After completing the settings, click “OK”.
6. Creating a Hello World Project
If Android Studio has been successfully installed, let’s create your first Android project. Let’s make a simple app that prints ‘Hello World’.
- After launching Android Studio, select “Start a new Android Studio project”.
- From the project templates, select “Empty Activity” and click “Next”.
- Enter the Project Name, Package Name, and Save location. Here, we will set the Project Name as “HelloWorld”.
- Select “Kotlin” as the Language and set the Minimum API level appropriately. For example, it can be set to API 21 (Android 5.0).
- Click “Finish” to create the project.
6.1 Editing the Activity Class
Open the MainActivity.kt file in the created project and check the following code.
package com.example.helloworld
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
}
}
6.2 Modifying the XML Layout
Edit the activity_main.xml file to add the user interface. Modify it as follows.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/hello_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
android:layout_centerInParent="true"
android:textSize="24sp"/>
</RelativeLayout>
6.3 Running the App
If the project setup is complete, let’s run the app now. Follow the steps below:
- Check if the Android Virtual Device (AVD) is set up. Click the AVD Manager icon in the top toolbar.
- If there is no AVD, click “Create Virtual Device” to create a new virtual device.
- Once the AVD is ready, click the “Run” button (or Shift + F10) in the top toolbar to run the app.
Conclusion
This article has provided a detailed explanation of the installation and initial setup of Android Studio. We also explored how to create a simple ‘Hello World’ app using Kotlin. In the next steps, we will implement more complex features and utilize various Android APIs to enhance the app. Stay tuned!