Launching the first application in Android Studio is a moment that separates theory and practice. Many beginners encounter errors even at the stage of setting up the environment, and experienced developers sometimes lose sight of optimizing the build process. This article will help you figure out how to properly launch a app in Android Studio โ€”from creating a new project to debugging on a physical device.

We will look at all the key steps: choosing an assembly configuration, setting up an emulator, connecting a smartphone via ADB, and also look at typical errors like Installation failed or Emulator not responding. We will pay special attention to the subtleties that are rarely mentioned in the official documentation - for example, how to speed up the first launch of the emulator or why the application may not open on some versions Android.

If you are just starting your journey in Android development, this guide will become your cheat sheet. Experienced programmers will find here tips on optimizing the workflow and diagnosing unobvious problems.

๐Ÿ“Š Which method of launching applications do you use most often?
Emulator only
Physical device only
Both options
Haven't tried it yet

1. Preparing Android Studio for the first launch

Before launching the app, make sure that your development environment is configured correctly. Android Studio requires preliminary configuration, especially if you installed it for the first time. Here's what you need to check:

  • ๐Ÿ“‹ SDK updates: Go to Tools โ†’ SDK Manager and install the latest versions Android SDK Platform and Android SDK Command-line Tools.
  • ๐Ÿ”ง Plugins: Make sure plugins are activated Android Support i Google Services v Settings โ†’ Plugins.
  • ๐Ÿ—ƒ๏ธ Gradle cache: Clear the cache via File โ†’ Invalidate Caches / Restartif synchronization errors occurred previously.
  • ๐Ÿ› ๏ธ Java JDK: Android Studio requires JDK 11 or later. Check the version in the terminal with the command java -version.

One โ€‹โ€‹of the most common sources of problems is incompatibility of Gradle versions. If, when synchronizing a project, you see an error like Gradle project sync failed, open the file gradle-wrapper.properties in the project root and update the distribution line:

distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip

Also check the file build.gradle (Project) โ€”it should contain the current version plugin Android Gradle Plugin:

classpath 'com.android.tools.build:gradle:8.1.0'
๐Ÿ’ก

If Android Studio takes a long time to load dependencies when first launched, open File โ†’ Settings โ†’ Build, Execution, Deployment โ†’ Gradle and enable the option Offline work. This will speed up the build, but will require manual updating of dependencies when changes build.gradle.

2. Creating a new project: step by step

To start the app, you first need to create a project. In Android Studio this is done through the wizard New Project. Let's look at the key points:

  1. Selecting a template: For the first launch, select Empty Activity โ€”this is the minimum required structure with one screen.
  2. Name and package: Specify Name (application display name) and Package name (a unique identifier in the format com.example.myapp).
  3. Language programming: Kotlin (recommended by Google) or Java. For beginners, it is easier to start with Javaif you are familiar with it.
  4. Minimum SDK version: Select API 21 (Android 5.0) or higher. You should not go lower - this will narrow the audience of users.

After creating the project Android Studio will automatically generate the file structure:

  • ๐Ÿ“ app/src/main/java/ โ€” source code (MainActivity.kt or MainActivity.java)
  • ๐Ÿ“ app/src/main/res/ โ€” resources (layouts, images, lines)
  • ๐Ÿ“„ app/build.gradle โ€” module assembly configuration
  • ๐Ÿ“„ AndroidManifest.xml โ€” application manifest

Pay attention to the file activity_main.xml in the folder res/layout โ€”the layout of the main screen is stored here. By default, there will be simple text. "Hello World!"It can be edited manually or through a visual editor Design.

What to do if the project is not created?

If it appears when creating a project error "Failed to create project", check:

1. Is there enough disk space (at least 3 GB of free space is required).

2. Are there any Cyrillic characters or spaces in the project path.

3. Is Android Studio running as administrator (sometimes required for writing to system folders).

3. Setting up the Android emulator

The emulator allows you to test the application without a physical device. However, setting it up is often difficult. Here's how to create a virtual device (AVD) Right:

  1. Open Tools โ†’ Device Manager.
  2. Click Create Device and select the model (for example, Pixel 5).
  3. Indicate the system: recommended Android 13 (API 33) or newer.
  4. In section System Image select x86_64 (for PC) or ARM (if you plan to test on Mac M1/M2).
  5. Configure the emulator settings: RAM (minimum 2 GB), Internal Storage (2 GB), enable Hardware - GLES 2.0 to speed up graphics.

After creating the emulator, you can launch it through the Play v Device Managerbutton. The first launch may take several minutes - the emulator downloads the necessary components. To speed up the process:

  • ๐Ÿš€ Use Quick Boot (enabled in the emulator settings).
  • ๐Ÿ’พ Create snapshot (Snapshot) after the first boot.
  • ๐Ÿ”„ Disable animation in the emulator developer settings (Settings โ†’ Developer options โ†’ Window animation scale โ†’ Off).

ARM-based emulators are slower than x86, but more accurately simulate real devices. If your processor supports virtualization (Intel VT-x or AMD-V), enable it in the BIOS for speedup.

Is it installed Hyper-V (for Windows) or KVM (for Linux)?

Are there enough RAM allocated (minimum 4 GB for emulator + system)?

Are other resource-intensive apps disabled?

Are video card drivers updated (to speed up OpenGL)?-->

4. Launching the app on the emulator

When the project and the emulator are ready, you can start launching. Here are the step-by-step guide:

  1. Make sure that the correct module is selected in the top panel ( Android Studio correct module selected (app) and device (your emulator).
  2. Press the green button Run (or Shift + F10).
  3. Wait for the project to build. In the window Build Output you will see the process log.
  4. After successful compilation, the emulator will automatically open your application.

If the launch does not occur, check:

Error Cause Solution
Error: app type already present Dependency conflict in build.gradle Run File โ†’ Invalidate Caches and rebuild the project
Emulator: PANIC: Missing emulator engine The emulator for the selected one is not installed architecture Reinstall the system via SDK Manager โ†’ SDK Tools โ†’ Android Emulator
Installation failed: INSTALL_PARSE_FAILED_MANIFEST_MALFORMED Error in AndroidManifest.xml Check tags <uses-sdk> and <application> for correctness
Device not authorized The emulator is not authorized for debugging Restart the emulator and confirm the resolution on the device

If the application starts, but you see a blank screen or an error "App not installed", check:

  • ๐Ÿ” Is it correct? package name v build.gradle?
  • ๐Ÿ“ฑ Is there enough space on the virtual device?
  • ๐Ÿ”’ Is the installer of unknown sources blocked in the emulator settings?
๐Ÿ’ก

Always start the emulator IN ADVANCE - waiting for it to load while building the project is ineffective. Open the emulator 1-2 minutes before pressing Run.

5. Running on a physical device

Testing on a real smartphone or tablet gives more accurate results than an emulator. To do this you need:

  1. Enable developer mode on the device:
    • Go to Settings โ†’ About phone.
    • Click 7 times on Build number.
    • Return to Settings - the item will appear For Developers.
  • Activate USB debugging USB debugging Settings โ†’ For developers โ†’ USB debugging.
  • Connect the device to the PC via USB cable (preferably original).
  • B Android Studio select your device in the drop-down list Run/Debug configurations.
  • If the device is not detected, do:

    • ๐Ÿ”Œ Check that the cable supports data transfer (not only charging).
    • ๐Ÿ”„ Switch USB mode to File transfer (MTP) in the notification shade.
    • ๐Ÿ–ฅ๏ธ Install drivers ADB for your model (for example Google USB Driver for Nexus/Pixel devices).
    • ๐Ÿ” Enter in the terminal Android Studio the command:
      adb devices

      If the device is displayed as unauthorized, confirm permission to phone.

    On some devices (for example, Xiaomi, Huawei), you additionally need:

    • ๐Ÿ”’ Allow Installation from unknown sources in the security settings.
    • ๐Ÿ”„ Enable USB debugging (security options) in the developer menu.
    • ๐Ÿ“ฑ Disable MIUI Optimization (for Xiaomi), if the application crashes on startup.
    ๐Ÿ’ก

    If the application is installed but closes immediately, check the logs in Logcat (tab at the bottom of Android Studio). Filter the output by tag AndroidRuntime โ€”there will be crash errors there.

    6. Optimizing the launch process

    Building and launching a project in Android Studio can take a lot of time. Here's how to speed up this process:

    • โšก Instant Run: Enable in Settings โ†’ Build, Execution, Deployment โ†’ Instant Run (does not work with all code changes).
    • ๐Ÿ—‘๏ธ Clear cache: Perform periodically File โ†’ Invalidate Caches / Restart.
    • ๐Ÿ“ฆ Multi-module projects: Divide the project into modules (app, core, features) for parallel assembly.
    • ๐Ÿ”„ Gradle daemon: Enable File โ†’ Settings โ†’ Build, Execution, Deployment โ†’ Gradle โ†’ Enable Gradle daemon.

    To speed up the emulator:

    • ๐Ÿ–ฅ๏ธ Use emulator with support for hardware acceleration (in the AVD settings, select Hardware - GLES 2.0).
    • ๐Ÿ’พ Create snapshot (Snapshot) for fast loading.
    • ๐Ÿ”ง Disable unnecessary emulator functions (for example, Live Wallpaper or Multi-Window).

    If you are working with Kotlin, add the following lines to gradle.properties to speed up compilation:

    kotlin.compiler.experimental=true
    

    kotlin.compile.incremental=true

    It is also useful for large projects:

    • ๐Ÿ“ฆ Use dynamic features (Dynamic Feature Modules) to load parts of the application on demand.
    • ๐Ÿ”„ Configure caching dependencies in gradle.properties:
      org.gradle.caching=true
    ๐Ÿ’ก

    The fastest way to test small changes is to use Apply Changes (lightning button next to Run). This updates the code without completely rebuilding the APK.

    7. Diagnosis and solution of common errors

    Even experienced developers encounter errors when starting up. Let's look at the most common ones and ways to solve them:

    Error Possible cause Solution
    Error: Failed to resolve: androidx.appcompat:appcompat:1.6.1 Problem connecting to repositories Google Maven Check your Internet connection and update repositories in build.gradle:
    google()
    

    mavenCentral()

    Emulator: emulator: ERROR: x86 emulation currently requires hardware acceleration! There is no support for virtualization in BIOS Enable Intel VT-x or AMD-V in the BIOS settings and install Intel HAXM (for Intel)
    Installation failed due to: 'Device not found' Device not detected through ADB Restart adb server commands:
    adb kill-server
    

    adb start-server

    Manifest merger failed: uses-sdk:minSdkVersion 15 cannot be smaller than version 16 Minimum SDK version conflict in dependencies Update minSdkVersion in build.gradle or exclude the problematic library

    If the application starts, but does not work correctly:

    • ๐Ÿ” Check logs in Logcat (filter by Error or WTF).
    • ๐Ÿ“ฑ Make sure that permissions in AndroidManifest.xml are requested correctly (for example, INTERNET or CAMERA).
    • ๐Ÿ”„ Clear application data on the device (Settings โ†’ Applications โ†’ Your application โ†’ Storage โ†’ Clear data).

    To diagnose performance problems:

    • ๐Ÿ“Š Use Android Profiler (View โ†’ Tool Windows โ†’ Profiler).
    • ๐Ÿ” Enable StrictMode to detect memory leaks or slow operations in the main stream.
    • ๐Ÿ› ๏ธ Check memory usage memory usage Memory Profiler.
    What to do if the emulator does not start?

    Try:

    1. Delete and create a new AVD with a different version of Android.

    2. Launch the emulator from the command line:

    emulator -avd YourAVDName -no-snapshot-load

    3. Disable the antivirus (sometimes it blocks the emulator files).

    8. data-i="297">In addition to standard tools

    In addition to standard means Android Studio, there are tools that simplify launching and testing:

    • ๐Ÿ”ง ADB AppControl: Utility for managing applications via ADB (installation, uninstallation, clearing cache).
    • ๐Ÿ“ฑ Genymotion: Alternative emulator with advanced functions (for example, simulating GPS or SMS).
    • ๐Ÿš€ Firebase Test Lab: Cloud testing on real devices (free up to 10 tests per day).
    • ๐Ÿ” LeakCanary: Library for detecting memory leaks in real time.

    To automate the launch, you can use:

    • ๐Ÿค– Gradle scripts: Write a custom task in build.gradle to build and install APK on several devices simultaneously.
    • ๐Ÿ“Ÿ CI/CD: Configure GitHub Actions or Bitrise to automatically run tests on every commit.

    Example of a Gradle task for installing an APK on all connected devices:

    task installDebugToAllDevices(type: Exec) {
    

    commandLine 'adb', 'devices'

    // Get a list of devices and install APK on each

    doFirst {

    def devices = commandLine.execute().text.readLines().tail().findAll { it.trim() }

    devices.each { device ->

    def deviceId = it.split()[0]

    exec {

    commandLine 'adb', '-s', deviceId, 'install', '-r', "${buildDir}/outputs/apk/debug/app-debug.apk"

    }

    }

    }

    }

    To work with Firebase Test Lab add to build.gradle:

    android {
    

    testBuildType "googlePlay"

    }

    dependencies {

    implementation 'com.google.firebase:firebase-appdistribution-gradle:3.2.0'

    }

    ๐Ÿ’ก

    If you are testing on several devices, use adb -s DEVICE_ID install app.apkwhere DEVICE_ID you can find out with the command adb devices.

    FAQ: Frequently asked questions about running apps in Android Studio

    ๐Ÿ”น Why does the emulator run very slowly?

    The speed of the emulator depends on several factors:

    • ๐Ÿ–ฅ๏ธ Hardware acceleration: Make sure that it is enabled in the BIOS virtualization (Intel VT-x or AMD-V).
    • ๐Ÿ’พ System type: Emulators on x86_64 work faster than on ARM.
    • ๐Ÿ“Š Dedicated resources: Increase the emulator RAM to 4 GB or more.
    • ๐Ÿ”„ Snapshots: Create a snapshot (Snapshot) after the first boot.

    Also try alternative emulators, for example Genymotion or BlueStacks (for testing games).

    ๐Ÿ”น How to run the application on your phone without a USB cable?

    There are several ways:

    1. Wi-Fi ADB:
      • Connect the device via USB and do:
        adb tcpip 5555
      • Disconnect USB and connect via Wi-Fi:
        adb connect IP_DEVICE:5555
  • Cloud services: Download the APK to Firebase App Distribution or AppCenter and install via the link.
  • Local network: Use tools like LocalSend or Snapdrop to transfer APK.
  • โš ๏ธ Attention: When connecting via Wi-Fi, make sure your PC and device are on the same network.

    ๐Ÿ”น What to do if the "No devices found" error occurs during startup?

    This error means that Android Studio does not see a single device to launch. Check:

    • ๐Ÿ”Œ Is the device connected via USB and is debugging enabled?
    • ๐Ÿ–ฅ๏ธ Is the emulator running (if you are using it)?
    • ๐Ÿ” Does ADB see the device? Run in the terminal:
      adb devices

      If the list is empty, restart adb server:

      adb kill-server
      

      adb start-server

    • ๐Ÿ”ง Are drivers installed for your device? For Samsung, Xiaomi and other brands may require proprietary drivers.

    If the problem persists, try:

    • Restart the device and PC.
    • Use a different USB port (preferably USB 3.0).
    • Disconnect other USB devices (they may conflict).
    ๐Ÿ”น Is it possible to run an Android app Studio without an emulator and a physical device?

    Technically yes, but with limitations:

    • ๐Ÿ“ฑ Cloud emulators: Services like BrowserStack or Sauce Labs allow test on real devices via a browser.
    • ๐Ÿ–ฅ๏ธ Robolectric: Framework for unit testing Android code on the JVM without a device.
    • ๐Ÿงช Instrumentation Tests: Can be run on Firebase Test Lab without a local device.

    However, to fully test the interface and functionality you definitely need a real device or an emulator.

    ๐Ÿ”น Why, after changing the code, does the application not update at startup?

    This can happen for several reasons:

    • โšก Instant Run disabled: Enable Settings โ†’ Build, Execution, Deployment โ†’ Instant Run.
    • ๐Ÿ—‘๏ธ Gradle cache is out of date: Run File โ†’ Invalidate Caches / Restart.
    • ๐Ÿ“ฆ Incorrect build configuration: Check that the Run/Debug Configurations option is selected Deploy: Default APK.
    • ๐Ÿ”„ Error in the code: If changes result in a compilation error, Android Studio may be using an old version of the APK.

    To force a rebuild of the project, use:

    • Build โ†’ Rebuild Project
    • Build โ†’ Clean Project (then Rebuild)

    If the problem persists, check the build logs in the window Build Output.