Android Studio is not just a development environment for creating mobile applications. It's a powerful tool that combines a code editor, emulators, performance analysis tools, and even built-in templates to speed up your work. Many novice developers use only basic functions, while professional capabilities remain unclaimed.

In this article we will look at newer versions, focusing on those functions that really save time. You'll learn how to not only write code, but also test it on virtual devices, optimize application performance, integrate Firebase, and even automate routine tasks. And if you are just starting out in Android development, here you will find step-by-step guide from scratch. Android Studio Giraffe (2022.3.1) and newer versions, focusing on those functions that really save time. You'll learn how to not only write code, but also test it on virtual devices, optimize application performance, integrate Firebase, and even automate routine tasks. And if you're just starting out in Android development, here you'll find step-by-step guide from scratch.

Important: some functions may differ depending on the version Android Studio and operating system (Windows, macOS, Linux). All screenshots and examples are given for the current version at the time of writing, but the interface and layout of elements may be updated. For accurate information, always check the official documentation.

1. Creating a new project: from a template to the first launch

The first thing that work in Android Studio starts with is the creation of a new project. The environment offers several ready-made templates that speed up the development of typical applications: from empty Empty Activity to complex structures with navigation (Navigation Drawer Activity) or tabs (Tabbed Activity).

To create a project:

  1. Run Android Studio and select New Project.
  2. In the list of templates, select the appropriate one (for example, Empty Views Activity for an application with a classic UI).
  3. Specify the project name, package (com.example.myapp), language (Java or Kotlin), and also the minimum version Android SDK (recommended at least API 21 for wide compatibility).
  4. Click Finish โ€”the studio will generate a basic structure with files MainActivity.kt (or .java) and activity_main.xml.

After creating the project, you can immediately run it on an emulator or physical device. To do this:

  • ๐Ÿ“ฑ Connect your smartphone via USB and enable USB debugging in the developer settings.
  • ๐Ÿ–ฅ๏ธ Or create a virtual device via AVD Manager (icon in the upper right corner).
  • โšก Click the green button Run (or Shift + F10).
๐Ÿ“Š What language do you use to develop under Android?
Kotlin
Java
Both options
Other

If the project does not start, check:

  • Is the required version installed (in Android SDK the required version (in SDK Manager).
  • Is the emulator or device connected (there may be connection errors). Logcat there may be connection errors).
  • Are there any syntax errors in the code (highlighted in red).
๐Ÿ’ก

Use hotkeys Ctrl + Shift + A (or Cmd + Shift + A on macOS) to quickly find any command or setting in Android Studio.

2. Working with an emulator: configuration and acceleration

Emulator Android v Android Studio allows you to test applications without a physical device. It supports different versions Android, screen resolutions and even hardware button configurations. However, by default the emulator can work slowly, especially on weak PCs.

To create a virtual device (AVD):

  1. Open AVD Manager via the icon in the toolbar or menu Tools โ†’ Device Manager.
  2. Click Create Virtual Device.
  3. Select device category (for example, Phone) and a specific model (for example, Pixel 5).
  4. Specify the system (Android 13, Android 12 etc.) and click Next.
  5. If necessary, change the parameters (memory size, graphic renderer) and complete creation.

To speed up the work emulator:

  • ๐Ÿš€ Use Hardware Acceleration (enabled in the emulator settings).
  • ๐Ÿ’พ Allocate at least 2 GB RAM for the virtual device.
  • ๐Ÿ–ผ๏ธ For graphics, choose Hardware - GLES 2.0 instead of software rendering.
  • ๐Ÿ”„ Save the state (Quick Boot) when closing, so as not to start the emulator from scratch.
Why an emulator slows down?

Most often the problem is insufficient PC resources. Close other apps, reduce the resolution of the emulated device, or use cloud services like Firebase Test Lab.

Emulator parameter Recommended value Why you need
RAM 2048 MB For smooth operation Android 10+
Internal Storage 4 GB Enough for most applications
Graphics Hardware Rendering acceleration
Boot Option Quick Boot Saves state between launches

If the emulator is still slow, try alternatives:

  • Genymotion - emulator with pre-installed configurations.
  • BlueStacks โ€”more suitable for testing games.
  • Physical devices via ADB (the most reliable option).

3. Code editor: productivity features

The code editor in Android Studio is based on IntelliJ IDEA, therefore it supports most of its functions: autocompletion, refactoring, live code analysis. But there are also unique features specific to Androiddevelopment.

Here 5 useful tricksthat will speed up your work:

  • ๐Ÿ” Search by code: Double Shift - finds classes, methods and even strings in resources.
  • ๐Ÿ”„ Live templates: enter toast + Tab โ€”the code for displaying the toast will be generated.
  • ๐Ÿ“ Multicursor: Alt + Click (or Cmd + Click on macOS) for simultaneous editing.
  • ๐Ÿ”ง Quick Fix: Alt + Enter โ€”corrects errors or suggests optimizations.
  • ๐ŸŽจ XML preview: open activity_main.xml and switch to the tab Design.

For working with Kotlin there are additional goodies:

  • ๐Ÿค– Automatic conversion Java to Kotlin (Code โ†’ Convert Java File to Kotlin File).
  • ๐Ÿงน Data Class: generation of data classes by template.
  • ๐Ÿ”— Smart Casts: automatic type casting after checks.

Set the theme (File โ†’ Settings โ†’ Appearance โ†’ Theme)|Customize the font and size (Editor โ†’ Font)|Enable white space displays (Editor โ†’ General โ†’ Appearance)|Create your own live templates (Editor โ†’ Live Templates)|Disable unnecessary inspections (Editor โ†’ Inspections)-->

Don't forget about hotkeys:

Ctrl + D // Duplicate line

Ctrl + Y // Delete line

Ctrl + Shift + / // Comment block

Alt + Insert // Code generation (constructors, getters)

4. Debugging and profiling: looking for bugs and optimizing

Debugging is an integral part of development. There are built-in tools for this: Android Studio There are built-in tools for this: Debugger, Logcat and Android Profiler. They help you find errors, analyze memory consumption and monitor performance.

To start debugging:

  1. Set breakpoints (breakpoints) next to the line numbers in the code.
  2. Click on the bug (Debug) or use Shift + F9.
  3. In the window that opens Debug monitor variables, call stack and expressions.

To analyze performance:

  1. Run the application in profiling mode (Run โ†’ Profile 'app').
  2. Open the tab Profiler at the bottom of the screen.
  3. View graphs CPU, Memory and Network.

Logcat is the console for output logs. To filter messages:

  • ๐Ÿ”Ž Enter your application tag (for example, MyAppTag).
  • ๐Ÿšจ Use log levels: Error, Warning, Info.
  • ๐Ÿ“ฑ Connect a physical device and select it in the drop-down list.
๐Ÿ’ก

If the application crashes without visible errors, check Logcat for the presence of ANR (Application Not Responding) or OutOfMemoryError.

For deep memory analysis:

  1. In Android Profiler go to the tab Memory.
  2. Click Dump Java Heap to create a heap dump.
  3. Look for memory leaks with using Memory Analyzer Tool (MAT).
โš ๏ธ Attention: When profiling on a physical device, some manufacturers (for example, Xiaomi, Huawei) block access to full logs. Enable USB Debugging (Security Settings) in the developer settings.

5. Integration with Firebase: Databases and Analytics

Firebase is a platform from Googlethat provides backend services for mobile applications: authentication, databases, cloud storage and analytics. Android Studio has built-in support Firebasewhich simplifies its connection.

To integrate Firebase:

  1. Open Tools โ†’ Firebase.
  2. In the panel Firebase Assistant select the desired service (for example Authentication or Realtime Database).
  3. Follow the instructions of the wizard: it will automatically add dependencies to build.gradle and generate template code.

Connection example Firebase Realtime Database:

  1. Add to build.gradle (Module: app):
    implementation 'com.google.firebase:firebase-database-ktx:20.3.0'
  2. Initialize Firebase in code:
    Firebase.database.setPersistenceEnabled(true)
    

    val database = Firebase.database

    val myRef = database.getReference("message")

    myRef.setValue("Hello, World!")

Popular services Firebase for Android:

  • ๐Ÿ”ฅ Authentication โ€” registration via email, Google, Facebook.
  • ๐Ÿ“Š Analytics โ€” collection of usage statistics applications.
  • ๐Ÿ’พ Cloud Firestore โ€” NoSQL database.
  • ๐Ÿ“ค Cloud Storage โ€” file storage (photos, videos).
  • ๐Ÿ”” Cloud Messaging (FCM) โ€” push notifications.
โš ๏ธ Attention: When working with Firebase in the free plan, there are limits on the number of requests and volume stored data. For commercial projects, set up notifications about exceeding quotas in the console Firebase.

6. Version control system: Git in Android Studio

Version control is a mandatory practice for any development team. Android Studio has built-in support Git, which allows you to commit changes, create branches and resolve conflicts directly from the IDE.

To get started working with Git:

  1. Initialize the repository: VCS โ†’ Enable Version Control Integration.
  2. Add files to the index: right click on the project โ†’ Git โ†’ Add.
  3. Make a commit: Ctrl + K (or Cmd + K on macOS), enter message.
  4. To work with a remote repository (for example, GitHub) use Git โ†’ Push.

Useful functions Git in Android Studio:

  • ๐ŸŒฟ Branches: creating and switching through Git โ†’ Branches.
  • ๐Ÿ”„ Merge: conflict resolution in the visual editor.
  • ๐Ÿ“œ Logs: viewing the commit history (Git โ†’ Show History).
  • ๐Ÿ” Blame: who changed a line of code and when (right click โ†’ Annotate).

If you work in a team, configure .gitignore for Androidproject. Example:

# Android

*.apk

*.ap_

/build/

/captures/

/gradlew

/gradlew.bat

/local.properties

/.idea/

/*.iml

๐Ÿ’ก

Always commit changes before major code edits. This will allow you to roll back to the working version if something goes wrong so.

7. Optimization and preparation for release

Before publishing the application in Google Play it needs to be optimized: reduce the size APK/AAB, check for errors and sign with a release key. Android Studio automates many of these tasks.

Steps to prepare for release:

  1. Code minimization: enable minifyEnabled true i shrinkResources true in build.gradle.
  2. Image optimization: use WebP instead PNG/JPEG and the tool Vector Asset Studio for icons.
  3. Testing: run Lint (Analyze โ†’ Inspect Code) to look for potential problems.
  4. Signing: generate a key via Build โ†’ Generate Signed Bundle / APK.

Formats assemblies:

  • ๐Ÿ“ฆ APK โ€”universal format, but larger in size.
  • ๐Ÿงฉ Android App Bundle (AAB) โ€”optimized for Google Play (generates optimal APK for each device).

Example configuration build.gradle for release:

android {

buildTypes {

release {

minifyEnabled true

shrinkResources true

proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'

}

}

}

โš ๏ธ Attention: Keep the signing key in a safe place! Without it, you will not be able to update the application in Google Play. It is recommended to use Google Play App Signing for additional protection.

8. Plugins and extensions: expanding functionality

Functionality Android Studio can be significantly expanded using plugins. They add support for new languages, design tools, integration with external services and much more.

How to install the plugin:

  1. Open File โ†’ Settings โ†’ Plugins.
  2. In the search, enter the name of the plugin.
  3. Click Install and restart Android Studio.

Useful plugins for Android-developer:

  • ๐ŸŽจ Android Drawable Importer โ€” generation of icons for different resolutions.
  • ๐Ÿ“ฑ ADB Idea โ€” quick commands ADB directly from the IDE.
  • ๐Ÿ” SonarLint โ€” static code analysis for errors.
  • ๐ŸŒ JSON To Kotlin Class โ€” generation of data classes from JSON.
  • ๐Ÿ“Š Android WiFi ADB โ€” debugging over Wi-Fi without USB.

Some plugins require additional configuration. For example, for Firebase Assistant you need to log in to your account Google, and for GitHub Copilot you need to get an API key.

How to remove a plugin if it slows down the studio?

Go to File โ†’ Settings โ†’ Plugins, find the plugin, click Uninstall and restart the IDE.

FAQ: Frequently asked questions about Android Studio

Can I use Android Studio on a weak PC?

Yes, but with reservations. Minimum requirements: 4 GB RAM, 2 GB free space (better 8 GB RAM i SSD). To speed up:

  • Disable unnecessary plugins.
  • Use Power Save Mode (File โ†’ Power Save Mode).
  • Reduce the size of the emulator or test on a physical device.
How to transfer a project from Eclipse to Android Studio?

Android Studio supports importing projects from Eclipse:

  1. To Android Studio select File โ†’ New โ†’ Import Project.
  2. Specify the path to the project Eclipse.
  3. Follow the instructions of the import wizard (it will update automatically build.gradle).

After import, check dependencies and update outdated libraries.

What to do if Android Studio does not see the device?

Connection problems devices are solved like this:

  • Make sure that USB debugging is enabled USB debugging (Settings โ†’ About phone โ†’ Build number (7 taps) โ†’ For developers โ†’ USB debugging).
  • Check drivers (for Windows, installation may be required Google USB Driver).
  • Restart ADB via the command:
    adb kill-server
    

    adb start-server

How to update Android Studio to the latest version?

The update occurs via:

  1. Help โ†’ Check for Updates (will automatically check and suggest update).
  2. Or download the new version from official website and install over the old one (the settings will be saved).

Before updating, close all projects and make a backup copy of the settings (File โ†’ Manage IDE Settings โ†’ Export Settings).

Is it possible to develop games in Android Studio?

Yes, but for games they usually use specialized engines:

  • Unity โ€” for 2D/3D games (exports the project to Android Studio for final assembly).
  • Godot โ€”open engine with support GDScript i C#.
  • LibGDX โ€”framework for Java/Kotlin, integrates directly into Android Studio.

For simple games (for example, Flappy Bird) you can get by with standard tools (SurfaceView, OpenGL ES).