Android Studio

How To Use Android Studio For Your First App

How To Use Android Studio For Your First App

Android Studio is the official integrated development environment for building Android apps using Kotlin or Java.

Google developed this IDE based on JetBrains IntelliJ IDEA specifically for Android development.

You need this tool when creating native Android applications, testing on emulators, or preparing apps for the Google Play Store.

This guide covers the complete workflow from installation to running your first app, requiring approximately 45 minutes and basic programming knowledge.

maxresdefault How To Use Android Studio For Your First App

Prerequisites

Before you start, make sure your system meets the minimum requirements for running Android Studio and the Android Emulator.

System Requirements

Windows: Windows 10/11 64-bit, 8 GB RAM minimum (16 GB recommended), 8 GB disk space plus space for Android SDK.

macOS: macOS 10.14 Mojave or higher, Apple Silicon or Intel processor, same RAM and storage requirements.

Linux: 64-bit distribution with GNOME or KDE desktop, GNU C Library 2.31 or later.

Required Knowledge

  • Basic understanding of software development concepts
  • Familiarity with either Kotlin or Java syntax
  • Understanding of XML for layout files

Time Estimate

Initial setup takes 30-45 minutes depending on your internet speed.

SDK downloads require additional time based on which API levels you select.

Why does Android dominate the mobile world?

Uncover Android development statistics: market share dominance, developer opportunities, ecosystem growth, and mobile innovation trends.

Explore Android Insights →

Step 1: How Do You Install and Launch Android Studio?

Download the installer from developer.android.com/studio, run the setup wizard with default settings, and wait for the IDE to download required SDK components on first launch.

Action

1. Download location: Visit developer.android.com/studio and click “Download Android Studio Ladybug” (or current version).

2. Installation path: Run the downloaded .exe (Windows), .dmg (macOS), or .tar.gz (Linux) file.

3. Setup wizard options:

  • Select “Standard” installation type
  • Choose your UI theme (Light or Darcula)
  • Accept license agreements for Android SDK and related components

4. Expected result: Android Studio opens with the Welcome screen showing options for New Project, Open, and Get from VCS.

Purpose

Proper installation ensures all Android SDK tools download correctly.

The standard setup includes the Android Emulator, platform tools, and build tools needed for mobile application development.

For detailed installation steps on different operating systems, see our guide on how to install Android Studio.

Step 2: How Do You Create a New Android Project?

Click “New Project” from the Welcome screen, select a project template like Empty Activity, configure your app name and package, then let Gradle sync the project files automatically.

Action

1. Menu path: Welcome Screen > New Project (or File > New > New Project if already in IDE).

2. Template selection:

  • Empty Activity: Blank starting point with minimal code
  • Basic Activity: Includes toolbar and floating action button
  • Bottom Navigation Activity: Pre-built navigation structure
  • Compose Activity: For Jetpack Compose UI toolkit

3. Project configuration fields:

  • Name: Your app’s display name (e.g., “My First App”)
  • Package name: Unique identifier like com.yourcompany.appname
  • Save location: Local folder path for project files
  • Language: Choose between Kotlin or Java
  • Minimum SDK: Lowest Android version your app supports (API 24 covers 98%+ of devices)

4. Expected result: Project opens with MainActivity file visible and Gradle sync completing in the background.

Purpose

Project templates provide working boilerplate code so you can focus on your app’s unique features.

The package name becomes your app’s unique identifier on the Google Play Store, so choose it carefully.

Minimum SDK selection affects which Android features you can use and how many devices can run your app.

Step 3: Where Do You Find the Main Code Editor and Project Files?

The Project panel on the left shows your codebase structure, while the center Editor panel displays file contents; switch between Android and Project view modes using the dropdown at the top of the Project panel.

Action

1. Project panel location: Left side of the window, shows file tree.

2. View mode toggle: Dropdown menu at top of Project panel.

  • Android view: Simplified structure grouped by type (manifests, java, res)
  • Project view: Actual file system structure

3. Key file locations in Android view:

  • app > java > [package] > MainActivity.kt: Main entry point code
  • app > res > layout > activitymain.xml: UI layout definition
  • app > manifests > AndroidManifest.xml: App configuration and permissions
  • Gradle Scripts > build.gradle.kts (Module: app): Dependencies and build settings

4. Editor panel features: Syntax highlighting, code completion (Ctrl+Space), error indicators, and quick fixes (Alt+Enter).

Purpose

Android view hides complexity by grouping files logically rather than showing the raw folder structure.

Understanding where files live speeds up navigation as your project grows.

The build.gradle.kts file controls your entire build process, making it a build automation tool configuration you’ll edit frequently.

Step 4: How Do You Design User Interface Layouts?

Open layout XML files from app > res > layout, use the Design tab to drag components from the Palette onto the canvas, and configure properties in the Attributes panel on the right side.

Action

1. Path to layouts: app > res > layout > activitymain.xml (double-click to open).

2. View modes: Toggle between Code, Split, and Design using icons in the top-right corner of the editor.

3. Layout Editor panels:

  • Palette: Drag UI components (TextView, Button, EditText, ImageView, RecyclerView)
  • Component Tree: Shows view hierarchy; useful for selecting nested elements
  • Attributes: Set properties like layoutwidth, layoutheight, text, id, constraints

4. Common layout types:

  • ConstraintLayout: Flexible positioning with constraints; recommended default
  • LinearLayout: Stacks views horizontally or vertically
  • FrameLayout: Single child view; good for fragments

5. Expected result: Visual preview updates in real-time as you add and configure components.

Purpose

The visual editor speeds up UI/UX design by letting you see changes instantly without running the app.

Following Material Design principles ensures your app looks consistent with other Android apps.

Step 5: How Do You Write and Edit Kotlin or Java Code?

Open MainActivity.kt from the java folder, use code completion with Ctrl+Space, fix errors with Alt+Enter quick actions, and run your code to test changes in the emulator or on a device.

Action

1. Path: app > java > [your.package.name] > MainActivity.kt (or .java).

2. Essential keyboard shortcuts:

  • Ctrl+Space: Code completion suggestions
  • Alt+Enter: Quick fixes and import suggestions
  • Ctrl+B: Go to declaration
  • Ctrl+Shift+F: Find in entire project
  • Ctrl+Alt+L: Reformat code

3. Code structure: onCreate() runs when activity starts; setContentView() links to your layout XML; findViewById() or View Binding connects UI elements to code.

4. Expected result: Error-free code with proper imports and syntax highlighting.

Purpose

Mastering keyboard shortcuts cuts development time significantly.

The IDE handles imports automatically, reducing boilerplate and letting you focus on logic.

When your code grows complex, use code refactoring tools (Shift+F6 to rename, Ctrl+Alt+M to extract method).

Step 6: How Do You Build and Run Your App on an Emulator?

Open Device Manager from Tools menu, create an Android Virtual Device with your target specifications, download the system image, then click the green Run button or press Shift+F10 to build and launch.

Action

1. Device Manager location: Tools > Device Manager (or click the phone icon in the toolbar).

2. Create Virtual Device wizard:

  • Select hardware profile (Pixel 7, Pixel Tablet, etc.)
  • Choose system image (select a Recommended image with Google Play)
  • Configure AVD name and startup orientation

3. Run button: Green triangle in toolbar, or Shift+F10, or Run > Run ‘app’.

4. Build output: Check Build panel (bottom of screen) for compilation progress and errors.

5. Expected result: Emulator window opens, shows Android boot animation, then launches your app.

For step-by-step emulator configuration, see how to use Android Studio emulator.

Purpose

Emulator testing catches UI issues across different screen sizes without owning multiple physical devices.

The Gradle build system compiles your code, processes resources, and packages everything into an APK automatically.

Step 7: How Do You Run Your App on a Physical Android Device?

Enable Developer Options and USB Debugging on your phone, connect via USB cable, select your device from the toolbar dropdown, then click Run to install and launch your app directly on hardware.

Action

1. Enable Developer Options: Settings > About Phone > tap “Build Number” 7 times.

2. Enable USB Debugging: Settings > Developer Options > USB Debugging > toggle ON.

3. Connect device: Use a data-capable USB cable (not charge-only); accept the debugging authorization prompt on your phone.

4. Device selection: Dropdown menu in toolbar shows connected devices; select your phone.

5. Run: Click green Run button or Shift+F10.

6. Expected result: App installs and opens on your physical device within seconds.

Troubleshooting connection issues? Check how to connect phone to Android Studio with USB.

Purpose

Physical device testing reveals real performance, battery impact, and sensor behavior that emulators cannot replicate.

Step 8: How Do You Debug Your Application?

Set breakpoints by clicking the line number gutter, click the Debug button (bug icon) or press Shift+F9, then use the Debug panel to inspect variables, step through code, and monitor Logcat output.

Action

1. Set breakpoints: Click in the gutter next to line numbers; red dot appears.

2. Start debugging: Click bug icon in toolbar or press Shift+F9.

3. Debug panel tabs:

  • Frames: Call stack showing execution path
  • Variables: Current values of local and member variables
  • Watches: Custom expressions you want to monitor

4. Step controls:

  • F8: Step Over (execute current line)
  • F7: Step Into (enter method)
  • Shift+F8: Step Out (exit current method)
  • F9: Resume (continue to next breakpoint)

5. Logcat panel: View > Tool Windows > Logcat; filter by app name, tag, or log level (Verbose, Debug, Info, Warn, Error).

Purpose

Breakpoint debugging pinpoints issues faster than Log.d() statements scattered through your code.

Logcat filtering helps isolate your app’s output from system noise.

For complex bugs, consider AI debugging tools that integrate with your workflow.

Step 9: How Do You Add Dependencies and Libraries?

Open build.gradle.kts (Module: app), add implementation lines in the dependencies block with the library’s group, artifact, and version, then click “Sync Now” to download and integrate the library.

Action

1. Path: Gradle Scripts > build.gradle.kts (Module: app).

2. Dependencies block syntax:

` dependencies { implementation("androidx.core:core-ktx:1.12.0") implementation("com.squareup.retrofit2:retrofit:2.9.0") testImplementation("junit:junit:4.13.2") } `

3. Sync: Click “Sync Now” banner or File > Sync Project with Gradle Files.

4. Finding libraries: Search Maven Central or Google’s Maven Repository; copy the implementation string.

5. Expected result: Library classes become available for import after successful sync.

Having sync issues? See how to sync Gradle in Android Studio.

Purpose

Dependencies add functionality like networking (Retrofit), image loading (Coil, Glide), and database access (Room) without writing everything from scratch.

Proper API integration through libraries follows tested patterns and saves development time.

Step 10: How Do You Generate a Signed APK or App Bundle?

Go to Build > Generate Signed Bundle / APK, create or select a keystore file, enter your key credentials, choose release build variant, then wait for the signed output file to generate in the app/release folder.

Action

1. Menu path: Build > Generate Signed Bundle / APK.

2. Format selection:

  • Android App Bundle (AAB): Required for Google Play Store; smaller downloads
  • APK: Universal format for direct installation or other app stores

Learn the differences in our APK or AAB comparison.

3. Keystore setup (first time):

  • Click “Create new” and choose a secure location
  • Set keystore password (remember this; you cannot recover it)
  • Create key alias with separate password
  • Fill validity (25 years recommended) and certificate info

4. Build variant: Select “release” for production builds.

5. Output location: app/release/app-release.aab or app-release.apk.

For APK-specific steps, check how to build APK in Android Studio.

Purpose

Signing proves you are the legitimate developer; Google Play requires signed bundles for all submissions.

Keep your keystore file and passwords safe; losing them means you cannot update your published app.

The release build includes ProGuard or R8 code shrinking for smaller file size and basic obfuscation.

Verification

After completing your first project, verify everything works correctly:

  • Build success: Build > Rebuild Project shows “BUILD SUCCESSFUL” in Build Output panel
  • No Gradle errors: build.gradle.kts files show no red highlighting
  • App runs: Your app launches on emulator or device without crashing
  • Signed build exists: app/release folder contains your .aab or .apk file

Check the Problems panel (View > Tool Windows > Problems) for any unresolved warnings or errors.

Troubleshooting

Gradle Sync Failed

Issue: Red error messages appear after opening project or changing dependencies.

Solution: File > Invalidate Caches > Invalidate and Restart, then File > Sync Project with Gradle Files.

Check your internet connection; Gradle downloads dependencies from remote repositories.

Emulator Runs Slowly

Issue: Android Virtual Device takes minutes to boot or runs laggy.

Solution: Enable hardware acceleration.

  • Windows/Linux: SDK Manager > SDK Tools > Intel x86 Emulator Accelerator (HAXM)
  • Verify virtualization is enabled in BIOS/UEFI settings
  • Use x86_64 system images instead of ARM on Intel/AMD processors

Device Not Detected

Issue: Physical phone does not appear in device dropdown.

Solution:

  • Try a different USB cable (use data cable, not charge-only)
  • Verify USB Debugging is enabled in Developer Options
  • Install device-specific USB drivers (Windows)
  • Revoke USB debugging authorizations and re-authorize

Build Errors with Unresolved References

Issue: Red underlines on class names; “Unresolved reference” errors.

Solution: Press Alt+Enter on the error to import the missing class.

If imports do not resolve, sync Gradle: File > Sync Project with Gradle Files.

Proper defect tracking helps you document recurring issues across projects.

Out of Memory Errors

Issue: IDE freezes or crashes during builds.

Solution: Increase memory allocation in Help > Edit Custom VM Options; add -Xmx4096m for 4GB heap size.

Close unused projects and heavy browser tabs.

Related Topics

Continue learning Android Studio with these guides:

Explore broader topics:

FAQ on How To Use Android Studio

Is Android Studio free to use?

Yes, Android Studio is completely free. Google provides it as an open-source IDE for all developers.

No subscription fees, no premium tiers. You get the full Gradle build system, Android Emulator, layout editor, and debugging tools at zero cost.

What programming language should I learn for Android Studio?

Kotlin is the recommended language. Google declared it the preferred choice for Android development in 2019.

Java still works and has extensive legacy support. New projects benefit from Kotlin’s concise syntax and null safety features. You can also build Android apps with Kotlin using modern coroutines for async operations.

How much RAM do I need to run Android Studio smoothly?

Minimum 8 GB RAM. Recommended 16 GB or more for comfortable multitasking.

Running the Android Emulator alongside the IDE consumes significant memory. With 8 GB, expect slowdowns during builds when the emulator runs simultaneously.

Can I use Android Studio for cross-platform development?

Not natively. Android Studio targets Android-only apps by default.

For cross-platform app development, add the Flutter plugin to build iOS and Android from one codebase. Compare your options in our Flutter or React Native guide.

Why is my Android Studio running slowly?

Common causes: insufficient RAM, disabled hardware acceleration, or too many plugins.

Increase heap size in Help > Edit Custom VM Options. Enable HAXM for Intel processors. Disable unused plugins in Settings > Plugins. Close background apps consuming memory.

How do I update Android Studio to the latest version?

Go to Help > Check for Updates (Windows/Linux) or Android Studio > Check for Updates (macOS).

The IDE downloads patches automatically. Major version upgrades may require manual download from the official site. Always backup projects before major updates.

Can I run Android Studio on a Chromebook?

Yes, on Chromebooks with Linux support enabled. Performance varies by hardware specs.

Enable Linux (Beta) in Chrome OS settings, then install the Linux version of Android Studio. Intel-based Chromebooks handle the Android Emulator better than ARM models.

How do I connect my project to GitHub in Android Studio?

Use VCS > Enable Version Control Integration > Git. Then VCS > Import into Version Control > Share Project on GitHub.

Enter your GitHub credentials when prompted. The IDE handles commits, pushes, and pulls through the Git panel. Proper source control prevents code loss and enables team collaboration.

What is the difference between Android Studio and IntelliJ IDEA?

Android Studio is built on IntelliJ IDEA Community Edition with Android-specific tools added.

IntelliJ IDEA supports broader development (Java, Kotlin, web). Android Studio includes the SDK Manager, AVD Manager, and layout editor optimized for mobile. See our detailed IntelliJ IDEA vs Android Studio comparison.

How do I delete a project I no longer need?

Close the project first: File > Close Project. Then delete the folder manually from your file system.

Android Studio does not have a built-in delete function. Remove the project from the Welcome screen’s recent list by right-clicking and selecting “Remove from Recent Projects.” Full steps in how to delete a project in Android Studio.

Conclusion

Learning how to use Android Studio opens the door to building professional Android apps with industry-standard tools.

You now understand project creation, layout editing, code completion, debugging with Logcat, and generating signed builds for the Google Play Store.

Practice is what makes these workflows automatic. Build small projects first.

Experiment with Jetpack Compose for modern UI development. Explore View Binding to eliminate findViewById calls. Add Firebase for backend services.

The IDE keeps improving. New features like profiler analysis and lint error checking help you write cleaner, faster code.

Start your first real project today. Use version control from day one. Ship something small, then iterate.

Your mobile app development timeline depends on consistent practice with these fundamentals.

50218a090dd169a5399b03ee399b27df17d94bb940d98ae3f8daff6c978743c5?s=250&d=mm&r=g How To Use Android Studio For Your First App

Stay sharp. Ship better code.

Every week: one curated article, one tool worth knowing, one tip you can use tomorrow. No noise, no padding.