Android Studio provides the fastest tools to create apps on any Android device.
Visual layout editor
ConstraintLayoutCreate complex layouts by adding constraints to other views and guidelines from each view. Then preview your layout on any screen size by selecting from a variety of device configurations or resizing the preview window.
Find opportunities to reduce the size of your Android app by reviewing the contents of your app APK file, even if it wasn’t created with Android Studio. Examine the manifest file, resources, and DEX files. Compare the two APKs to see how your app size varies between app versions.
Load and run your apps faster from a physical device, and simulate different configurations and features, including ARCore, Google’s platform for creating augmented reality experiences.
Intelligent code editor
Write better code, work faster, and be more productive with an intelligent code editor that provides code completion for Kotlin, Java, and C / C ++ languages.
Flexible structure system
Powered by Gradle, Android Studio’s build system allows you to customize your build to create multiple build variants for different devices from a single project.
Real time profilers
Built-in profiling tools provide real-time statistics for your application’s CPU, memory, and network activity. Identify performance bottlenecks and view inbound and outbound network loads by recording method traces, reviewing heap and allocations.
Android Studio Download
Android Studio User Guide
Android Studio is the official Integrated Development Environment (IDE) for IntelliJ IDEA-based Android application development. Besides IntelliJ’s powerful code editor and developer tools, Android Studio offers even more features that increase your productivity when building Android apps, such as:
- A flexible Gradle based building system
- A fast and feature rich emulator
- A unified environment you can develop for all Android devices
- Apply changes to send code and resource changes to your running app without restarting your app
- Code templates and GitHub integration to help you create common application features and import sample code
- Comprehensive testing tools and frameworks
- Lint tools to capture performance, availability, version compatibility, and other issues
- C ++ and NDK support
- Built-in support for Google Cloud Platform makes it easy to integrate Google Cloud Messaging and App Engine
This page provides an introduction to basic Android Studio features.
Every project in Android Studio contains one or more modules containing source code files and source files. Module types include:
- Android application modules
- Library modules
- Google App Engine modules
By default, Android Studio displays your project files in Android project view as shown in figure 1. This view is organized by modules for quick access to your project’s core resource files.
All build files are visible at the top level under Gradle Scripts , and each application module contains the following folders:
- notifications :
AndroidManifest.xmlContains the file.
- java : Contains Java source code files, including the JUnit test code.
- res : Contains all non-code resources such as XML layouts, UI strings, and bitmap images.
The Android project structure on disk is different from this flattened representation. To see the actual file structure of the project, select Project named Project opens (in Figure 1, it shows up on Android ).
You can also customize the appearance of project files to focus on specific aspects of your application development. For example, selecting the Issues view for your project displays links to source files that contain recognized encoding and syntax errors, such as the missing XML element closing tag in a layout file.
The Android Studio main window consists of several logical fields defined in figure 3.
- The toolbar allows you to perform a wide variety of actions, including running your application and launching Android tools.
- The navigation bar helps you navigate between your project and open files for editing. It provides a more compact view of the structure visible in the project window.
- The editor window is where to create and modify the code. The editor may differ depending on the file type available. For example, when viewing a layout file, the editor displays the Layout Editor.
- The tool window bar works outside the IDE Window and contains buttons that allow you to expand or collapse individual tool windows.
- Tool windows provide access to specific tasks such as project management, search, version control, and more. You can expand and collapse them.
- The status bar displays the status of your project and the IDE itself, as well as any warnings or messages.
You can edit the main window to give yourself more screen space by hiding or moving toolbars and tool windows. You can also use keyboard shortcuts to access most IDE features.
Whenever you want, it can be found in your source code, databases, actions, elements of the user interface, etc. You can search. window. This can be very useful, for example, if you’re trying to find a specific IDE action you forget how to trigger.
Instead of using preset perspectives, Android Studio follows your context and automatically opens relevant tool windows as you work. By default, the most frequently used tool windows are pinned to the tool window bar at the edges of the application window.
- To expand or collapse a tool window, click the tool’s name in the tool window bar. You can also drag, pin, unpin, add and detach tool windows.
- Click Window> Restore Default Layout to return to the current default tool window layout , or customize your default layout by clicking Window> Save Current Layout as Default .
- To show or hide the entire tool window bar , click the window icon in the lower left corner of the Android Studio window.
- To find a specific tool window, hover over the window icon and select the tool window from the menu.
You can also use keyboard shortcuts to open tool windows. Table 1 lists the shortcuts to the most common windows.
|Tool window||Windows ve Linux||Mac|
|Project||Alt + 1||Command + 1|
|Version Control||Alt + 9||Command + 9|
|Run||Shift + F10||Control + R|
|Debugging||Shift + F9||Control + D|
|Logcat||Alt + 6||Command + 6|
|Return to Editor||ESC||ESC|
|Hide All Tool Windows||Control + Shift + F12||Command + Shift + F12|
If you want to hide all toolbars, tool windows and editor tabs, click View> Enter Non-Disturbing Mode . This enables No Distraction Mode . Click View> Exit Distraction Free Mode to exit No- Distraction Mode .
You can use Instant Search to search and filter most tool windows in Android Studio . To use Quick Search, select the tool window and then type your search query.
For more tips, see. Android Studio Keyboard shortcuts .
Android Studio has three types of code completion that you can access using keyboard shortcuts.
|Kind||Explanation||Windows ve Linux||Mac|
|Basic Completion||Variables, types, methods, expressions, etc. Displays basic recommendations for. If you call basic completion twice in a row, you’ll see more results, including custom members and non-imported static members.||Control + Space||Control + Space|
|Smart Completion||Displays related options according to context. Smart completion is aware of the expected type and data streams. If you search for Smart Complete twice in a row, you’ll see more results, including chains.||Control + Shift + Space||Control + Shift + Space|
|Notification Completion||Missing parentheses, square brackets, braces, formatting, etc. By adding it completes the existing statement for you.||Control + Shift + Enter||Shift + Command + Enter|
You can also make quick fixes and show intent actions by pressing Alt + Enter .
Find sample code
The Code Sample Browser in Android Studio helps you find high-quality, Google-supplied Android code samples based on the currently highlighted symbol in your project.
Here are some tips to help you navigate Android Studio.
- Use the Recent Files action to switch between the files you accessed most recently. Press Control + E ( Command + E on a Mac ) to bring up the Recent Files action . By default, the most recently accessed file is selected. You can also access any tool window from the left column in this action.
- View the structure of the current file using the File Structure action. Open the File Structure action by pressing Control + F12 ( Command + F12 on the Mac ). Using this action, you can quickly navigate to any part of your current file.
- Search for a specific class in your project using the Go to Class action and go there . Start the action by pressing Control + N ( Command + O on a Mac ). Go to Class supports complex expressions, including camel bumps, paths, row navigation, middle name matching, and much more. If you call it twice in a row, it will show you the results of the project classes.
- Go on a file or folder using the file operations go . Open the Go To File action by pressing Control + Shift + N ( Command + Shift + O on the Mac ). Add a / at the end of your statement to search for folders instead of files.
- Go to Symbol to a method or field of action by name using the go . Open the Go To Symbol action by pressing Control + Shift + Alt + N ( Command + Option + O on the Mac ) .
- Find all pieces of code that refer to the class, method, field, parameter, or expression at the current cursor position by pressing Alt + F7 ( Option + F7 on the Mac ) .
Style and formatting
As you edit, Android Studio automatically applies formatting and styles as specified in your code style settings. You can customize the code style settings with the programming language, including rules for tabs and indents, spaces, wrap and braces, and empty lines. Click File> Settings> Editor> Code Style ( Android Studio> Preferences> Editor> Code Style on a Mac) to customize your code style settings .
Although the IDE automatically applies formatting while you work, you can explicitly call the Reformat Code action by pressing Control + Alt + L ( Opt + Command + L on the Mac ) or press Control + Alt + I to indent all lines. ( Control + Option + I on Mac ).
Basics of version control
Android Studio; Supports various version control systems (VCS) including Git, GitHub, CVS, Mercurial, Subversion, and Google Cloud Source Repositories.
After importing your application into Android Studio, use the Android Studio VCS menu options to enable VCS support for the desired version control system, create a repository, transfer new files to version control, and perform other version control operations:
- From the Android Studio VCS menu, click Enable Version Control Integration .
- Select a version control system to be associated with the project root from the drop down menu and then click OK .
The VCS menu now displays a number of version control options depending on the system you select.
Note: You can also use the File> Settings> Version Control menu option to set up and change version control settings .
Gradle build system
Android Studio uses Gradle as the basis of its build system, with more Android-specific capabilities provided by the Android plugin for Gradle. This build system works as an integrated tool from the Android Studio menu and independently of the command line. You can use the features of the building system to do the following:
- Customize, configure and expand the build process.
- Create multiple APKs with different features for your app using the same projects and modules.
- Reuse code and resources in resource sets.
Using Gradle’s flexibility, you can do all this without altering your application’s core source files. Android Studio build files are named
build.gradle. They are plain text files that use Groovy syntax to configure compilation with elements provided by the Android plugin for Gradle. Each project has a top level build file for the entire project and separate module level build files for each module. When you import an existing project, Android Studio automatically generates the required build files.
The build system can help you create different versions of the same application from a single project. This is useful when you have both a free and paid version of your app or you want to distribute multiple APKs for different device configurations on Google Play.
Multiple APK support
Multi APK support allows you to efficiently generate multiple APKs based on screen density or ABI. For example, you can create separate APKs of an app for hdpi and mdpi screen densities, while you can treat them as a single variant and allow them to share test APK, javac, dx, and ProGuard settings.
Resource minimization in Android Studio automatically removes unused resources from your packaged app and library dependencies. For example, if your app uses Google Play services to access the Google Drive functionality and you are not currently using Google Sign-in, resource throttling
SignInButtoncan remove various drawable assets for buttons.
Note: Source shrink works with code minification tools like ProGuard.
Dependencies for your project are
build.gradlespecified in the file by name. Gradle takes care to find your addictions and make them available to your structure.
build.gradleYou can declare module dependencies, remote binary dependencies, and local binary dependencies in your file. Android Studio configures projects to use Maven Central Repository by default. (This configuration is included in the project’s top level build file.)
Debug and profile tools
Android Studio helps you improve the performance and debug your code, including inline debugging and performance analysis tools.
Use inline debugging to improve your code navigation in the debugger view with inline validation of references, expressions, and variable values. Inline debug information includes:
- Inline variable values
- Referencing objects that reference a selected object
- Method return values
- Lambda and operator expressions
- Tooltip values
To enable inline error debugging Debug window Settings , click and Values Show Inline select the check box.
Android Studio provides performance profilers so you can more easily monitor your application’s memory and CPU usage, find unallocated objects, find memory leaks, optimize graphics performance, and analyze network requests. With your app running on a device or emulator, open the Android Profiler tab.
While profiling memory usage in Android Studio, you can simultaneously initiate garbage collection and dump the Java stack into a batch snapshot in an Android-specific HPROF binary format file. The HPROF viewer displays classes, instances of each class, and a reference tree to help you monitor memory usage and find memory leaks.
You can use Memory Profiler to track memory allocation and track where objects are allocated when you take certain actions. Knowing these allocations allows you to optimize the performance and memory usage of your application by adjusting the method calls for these actions.
Data file access
Android SDK tools such as systrace and logcat generate performance and debug data for detailed application analysis.
Open the Captures tool window to view the existing data files generated. In the list of created files, double-click a file to view the data.
.hprofRight-click any file to search for your standard RAM usage file format.
Every time you compile your program, Android Studio automatically runs structured Lint and other IDE controls to help you easily identify and fix problems with the structural quality of your code.
The Lint tool checks your Android project source files for potential errors and makes optimization improvements for accuracy, security, performance, usability, accessibility, and internationalization.
In addition to lint checks, Android Studio performs IntelliJ code reviews and validates annotations to streamline your coding workflow.
Annotations in Android Studio
Android Studio supports annotations for variables, parameters, and return values to help you catch errors such as null pointer exceptions and resource type conflicts. The Android SDK Manager packages the Support-Annotations library in the Android Support Repository for use with Android Studio. Android Studio verifies annotations configured during code review.
When you build and run your application with Android Studio, you can view adb output and device log messages in the Logcat window.
If you want to profile your application’s CPU, memory and network performance, click Android Profiler, click View> Tool Windows> Android Profiler .
Sign in to your developer account
You can sign in to your developer account in Android Studio to access additional tools that require authentication, such as Cloud Tools for Android Studio and the App Actions test tool . By signing in, you give these tools permission to view and manage your data in Google services.
After you open a project in Android Studio, you can sign in to your developer account or switch between developer accounts as follows:
Click the profile icon at the end of the toolbar as shown in Figure 8.
In the window that appears, do one of the following:
- If you’re not signed in yet, click Sign In and allow Android Studio to access the listed services.
- If you’re already signed in, click Add Account to sign in with another Google account . Alternatively, you can click Sign Out and repeat the previous steps to sign in to a different account.