Creating a mobile application from scratch may seem like a difficult task, especially if you are just starting to master Android Studio โthe official development environment from Google. However, the process of launching your first project is much simpler than it seems: you just need to follow a logical sequence of steps and understand the key points. This article will help you understand not only the technical side (installing software, setting up an emulator, writing code), but also the nuances that save hours of debugging: from choosing the right version SDK to optimizing the performance of the emulator.
Many beginners encounter typical errors: the project does not build due to incorrect dependencies in build.gradle, the emulator slows down on weak PCs, or the application crashes on startup due to unaccounted for permissions. We will analyze each stage in detail - from installation Android Studio Giraffe 2023 (current for 2026) to debugging on a real device. And if you have already tried to run projects, but encountered problems, the article has a section with solutions to the most common errors.
โ ๏ธ Attention: The Android Studio interface and requirements SDK are periodically updated. If you are using a newer version Giraffe 2023, some menu items may differ. For critical parameters (for example, minSdkVersion) check with official documentation.
1. Preparing the working environment: installing Android Studio and SDK
Before creating a project, you need to install the development environment itself and related tools. Android Studio is available for Windows, macOS and Linux, but system requirements vary. For example, for comfortable work on Windows 11 you will need at least 8 GB of RAM (recommended 16 GB for the emulator) and 4 GB free disk space for SDK.
Download the latest stable version from official website (for 2026 it is Android Studio Giraffe 2023.2.1 or newer). During installation, select the components:
- ๐ฑ Android SDK โa set of tools for development;
- ๐ฅ๏ธ Android Virtual Device (AVD) โfor creating emulators;
- ๐ง Android SDK Command-line Tools โfor working with
adband other utilities; - ๐ Google USB Driver (only for Windows) - for connecting real devices.
After installation, run Android Studio and wait until the initial setup is completed. The system will automatically offer to download the latest versions SDK Platform (it is recommended to select Android 14 (API 34) or Android 13 (API 33) for compatibility).
2. Creating a new project: templates and key settings
When you first start Android Studio you will be prompted to create a new project. It is important to choose the right template here so as not to waste time removing unnecessary code. For starters, Empty Activity is the minimum required set of files to launch an application with one activity.
At the project configuration stage, specify:
- ๐ Name โ application name (for example,
MyFirstApp); - ๐ฑ Package name โ unique identifier in the format
com.example.myfirstapp; - ๐ Save location โ folder for storing project files;
- ๐ข Language โ
JavaorKotlin(recommendedKotlinas the priority language for Android); - ๐ Minimum SDK โ the minimum version of Android that the application supports (optimally
API 24: Android 7.0to cover 95% of devices).
Critical: If you choose minSdkVersion below 21, some modern libraries (for example Jetpack Compose) may not be supported. Check the library requirements in the documentation before choosing a version.
โ๏ธ Check before creating a project
3. Project structure: what is where and why you need it
After creating the project, its structure will be displayed in the left panel:
| Folder/File | Purpose | Example content |
|---|---|---|
app/src/main/java/... |
Source code for Kotlin/Java |
MainActivity.kt - main activity |
app/src/main/res/ |
Resources: layouts, images, strings | layout/activity_main.xml, drawable/ic_launcher.png |
app/build.gradle |
Build configuration and dependencies | minSdkVersion 24, implementation 'androidx.appcompat:appcompat:1.6.1' |
app/manifests/AndroidManifest.xml |
Manifest with permissions and component declarations | <uses-permission android:name="android.permission.INTERNET" /> |
Pay special attention to the file AndroidManifest.xml. Here, declaring all activities, services and permissions. For example, if your application requires Internet access, add the line:
<uses-permission android:name="android.permission.INTERNET" />
โ ๏ธ Attention: If you forget to declare a permission in the manifest, the application will crash when trying to use the corresponding function (for example, a network request), but no obvious error in the logs. Always check Logcat for the presence of SecurityException.
4. Setting up an emulator or connecting a real device
To test the application, you can use Android emulator or connect a physical device via USB. The emulator is convenient for quick checks, but can be slow on weak PCs. A real device gives a more accurate picture of performance, but requires enabling USB Debugging.
Setting up the emulator:
- Open
AVD Manager(button in the upper right corner of Android Studio). - Click
Create Virtual Deviceand select the model (for example, Pixel 5). - Select the system image (recommended
Android 14 (API 34)c Google Play). - Configure parameters:
RAM: 2048 MB,VM Heap: 512 MB,Internal Storage: 2 GB. - Run the emulator button
Play.
Connecting a real device:
- Enable
Developer modeon your phone: go toSettings โ About phone โ Build numberand tap 7 times. - Go back to
Settings โ System โ Developer modeand turn onUSB Debugging. - Connect the device to the PC by USB and confirm permission for debugging.
- In Android Studio select the device in the drop-down menu next to the button
Run.
If the emulator is slow, try enabling Hardware Acceleration in the AVD settings or reducing the screen resolution to 720p.
5. Launching and debugging the project: first steps
When the project is created and the emulator or device is ready, you can run the application. Press the green button Run (or Shift + F10). Android Studio will automatically build the project (Build) and install APK on the selected device.
If the assembly was successful, you will see a standard screen with text "Hello World!". But what to do if errors occur? Here are the most common problems and their solutions:
- โ Error:
Failed to install APK
Cause: There is not enough space on the device or emulator.
Solution: Clear the cache or increaseInternal Storagein the AVD settings. - โ Error:
No devices available
Cause: The emulator is not running or the device is not recognized.
Solution: Check the connection by USB or restartadbcommandadb kill-server && adb start-server - โ Error:
Gradle build failed
Cause: Problems with dependencies or syntax inbuild.gradle.
Solution: Update Gradle (in filegradle-wrapper.properties) or synchronize the project with the buttonSync Now.
For debugging, use the tab Logcat (at the bottom Android Studio). Application logs are displayed here. To filter messages, enter your application tag (by default - MainActivity) in the search field.
How to read logs in Logcat?
Logs are divided into severity levels: ERROR (red), WARNING (orange), INFO (blue), DEBUG (green). To search for errors, look for lines with E/ for example, E/AndroidRuntime: FATAL EXCEPTION indicates an application crash.
6. Optimization and further steps
After the successful launch of the basic project, you can move on to improvements. Here are some tips for improvement:
- ๐ Add a new activity: Right click on the folder
app/src/main/java/...โNew โ Activity โ Empty Activity. - ๐จ Edit design: Open
res/layout/activity_main.xmland drag elements from the palette Design. - ๐ฆ Connect libraries: Add dependencies to
build.gradle, for example, for working with images:implementation 'com.github.bumptech.glide:glide:4.16.0' - ๐ Test on different devices: Create several AVD with different versions of Android and screen resolutions.
To speed up development, use Live Templates (code templates). For example, enter toast in the editor and click Tab - the code will automatically be generated to display a pop-up message:
Toast.makeText(this, "", Toast.LENGTH_SHORT).show()
โ ๏ธ Attention: When adding new libraries, always check their compatibility with yours minSdkVersion. Some libraries (for example, CameraX) require API 21+, and others (like Jetpack Compose) โ API 24+.
Always test the application on a real device before release - the emulator does not show performance problems on weak smartphones.
7. Common errors and their solutions
Even experienced developers encounter bugs when starting projects. Here are the top 5 problems and ways to fix them:
| Error | Cause | Solution |
|---|---|---|
Installation failed due to invalid APK |
Damaged file APK or incompatibility with the device | Clean the project (Build โ Clean Project) and rebuild |
Emulator: PANIC: Missing emulator engine app |
Emulator components not installed | Open SDK Manager โ SDK Tools and install Android Emulator |
Manifest merger failed |
Permission or tag conflict in AndroidManifest.xml |
Check for duplicate permissions or tags <activity> |
Could not determine the dependencies of task ':app:compileDebugKotlin' |
Incompatibility of versions Kotlin and plugins | Update the version Kotlin in build.gradle (Project) |
If the error is not from the list, use by searching the logs in Logcat. Copy the line from Exception and enter it into Google or Stack Overflow โin 90% of cases there is already a solution.
FAQ: Answers to popular questions
Is it possible to run Android Studio projects on M1/M2 Mac?
Yes, but required Android Studio Chipmunk 2021.2.1 or later. Install Rosetta 2 for the emulator x86 or use the emulator on ARM (slower, but works natively). Also check that SDK Manager is installed Android Emulator (ARM 64) and Android SDK Platform-Tools.
How to reduce the APK size?
Enable minifyEnabled true and shrinkResources true in build.gradle (Module: app). Also remove unused resources (Refactor โ Remove Unused Resources) and use WebP instead PNG/JPEG for images.
What to do if Gradle takes a long time to build a project?
You can speed up the build like this:
- Enable
Offline ModeinFile โ Settings โ Build, Execution, Deployment โ Gradle. - Increase heap memory for Gradle in the file
gradle.properties:org.gradle.jvmargs=-Xmx4096m -XX:MaxMetaspaceSize=1024m - Use cache: add
org.gradle.caching=trueto that the same file.
How to run a project on a phone without USB (via Wi-Fi)?
First, connect the device via USB and run the commands:
adb tcpip 5555
adb connect IP_DEVICE:5555
Then disconnect USB โthe device will remain available for debugging by Wi-Fi (until it reboots).
Where are Android Studio projects stored by default?
B Windows: C:\Users\USERNAME\AndroidStudioProjects\
B macOS/Linux: /Users/USERNAME/AndroidStudioProjects/
The path can be changed when creating a project.