Hello Guys, this is Android Studio Tutorial. We will take a look at all the features which are available in Android Studio. Android Studio is the official IDE(Integrated Development Environment) for all development on Google’s Android Platform. It is based on JetBrains IntelliJ IDEA Software and is the IDE of choice for the Android Development. It is designed to accelerate the complete android development phase and provide tools to build and test best apps for all android based devices.
- 1 Android Studio Instant Run Feature
- 2 Intelligent code editor
- 3 Android Studio Emulator
- 4 Memory Monitor
- 5 Flexible and Easily Configurable build system
- 6 Working with GIT
- 7 What’s Next ??
- 8 Related
Earlier android developers used to do android development using Eclipse as primary IDE using the ADT plugin, Not only it was difficult to configure Eclipse, but there were many bugs in the ADT Plugin making it difficult to develop and test Android Apps. Now Google recommends Android Studio for everyone who is interested in Developing Android apps. It is officially supported and maintained by Google development team and receives quick updates. In terms of features, Android Studio contains a lot of features that Eclipse didn’t have and new features are added to Android Studio to enhance productivity every now and then. It offers tools that are tailored specifically for Android Developers.
As of this Android Studio Tutorial, the latest available version is Android Studio 2.3. Android Studio is available for Windows, Mac, and Linux. So let’s get started, In this Android Studio tutorial, we will discuss some of the best features offered to you by Android Studio like powerful code editing, classic debugging and testing as well as profiling tools.
Android Studio Instant Run Feature
Android Instant Run Feature was introduced with Android Studio 2.0. Using Android Studio Instant Run Feature you can push code changes and the resource changes to your android app running on a physical android or emulator almost instantly.
It dramatically reduces the time Android Developers spend during the development cycles thereby increasing productivity exponentially.
Before the Feature was introduced, developers had to recompile the complete code, convert it to Dex format, generate the APK package file and install it each time they make any edits to their code. This process used to take away a lot of Developers time depending upon the size of Android Application and your machine’s configuration where IDE is setup. In contrast, with Instant Run will push the code changes to the running app and dynamically “swap” the changes.
We won’t go into details of working of Android Instant Run Feature in this Android Studio Tutorial and will be covering it as a separate topic.
Enabling/Disabling the Android Instant Run Feature
Instant Run can be enabled and disabled by going to using the Android Studio Settings. To view the current settings begin by selecting the File -> Settings -> Build, Execution, Deployment -> Instant Run as shown below.
Using Instant Run
When an Android Project is loaded into Android Studio for the first time and, but is still not running on your device still, the Run Instant Run and Debug button will be as shown below
You can use the Android Studio Instant Run Feature by clicking the Instant Run Button, the one in the center with a Lightning symbol.
Intelligent code editor
Android Studio IDE is based upon the JetBrains IntelliJ IDE and has very advanced code completion, code analysis and refactoring capabilities. All these features allow developers to code better and faster and become more productive.
As discussed above Android Studio code editor is tailor-made for Android Development and comes with advanced code completion capabilities for Java language syntax like classes, interfaces and the methods. As soon as you start typing in the Android Studio Code Editor, it will scan and provide appropriate suggestions for the developer making his job easier and reducing the typing effort.
For example: For Creating Getter and Setters, toString(), Delegate Methods etc.
Right Click on your Code -> Generate
With Practice, a lot of them will come on your tips. You can also add your own Keyboard shortcuts especially for syncing the Gradle Files. You can double click on the “Sync Project with Gradle Files” and hit Add Keyboard Shortcuts.
Right Click on your File(for ex: any JAVA file or Mipmap image) -> Refractor -> Rename. This will rename all occurrences of that file.
To access your Variables and methods quickly, you may hit Alt+7 and access the structure view. It is just like an Outline view in Eclipse
Importing an Existing Project
Android Studio allows you to import existing android projects to Android Studio.
In Android Studio, go to File -> New -> Import Project.
A window labeled Select Eclipse or Gradle Project will appear. Select the unzipped project you want to import and click OK.
Project Structure or Settings
Android Project structure is available in various modes for example, the by default structure shows different folders like src, Res, Drawable etc. You can also switch to Android Mode, or the package Mode.
SDK Manager allows you to download and install APIs and tools for development, from the Internet. You can download required packages for your IDE from here.
Android Studio Emulator
As the name suggests the Android Studio Emulator simulates a device and displays the app on your development computer. It is very useful to quickly prototype, develop, and test Android apps on all possible configurations without the need of having any physical devices. With the latest Android Studio comes fast and improved Emulator with predefined device types to quickly get started.
Now the Android Emulator utilizes the multicore processors present in the development environment to further speed up the development process and improving the emulator performance.
Android Virtual Device configurations
Android Virtual Device (AVD) configuration determines the look, functionality and hardware aspects of the Emulator devices and allows you to create multiple configurations allowing developers to test for multiple devices like phone, tablet, Android TV and across multiple configurations.
We use the AVD Manager to create and manage AVDs.
To Run an App in the Android Emulator, click on Run Icon
A dialog will appear showing you the available Virtual Devices and asking you to Select Deployment Target. If you have already created an AVD configurations you can choose it and the App will start in the Emulator.
If you don’t have an AVD configuration you need to create one before starting the app in the Emulator.
If you want to know the memory consumption of your app. You can follow these steps below:
- Run your Android Application
- Launch Android Monitor
- Click Monitors tab and display Memory the Monitor
- Enable Memory Monitor by clicking Pause icon to deselect it.
You can see the CPU, GPU and Network Monitors below the Memory Monitor
Flexible and Easily Configurable build system
Android Studio provides robust and easily configurable build system. It allows to include multiple code libraries and produce many build variants for your app. It allows developers to compile resources and code and package them in APKs. You can then deploy the APK on your emulator or test device, sign it digitally and place it on Play Store and other distribution channels.
Android Studio uses the Gradle build system to automate the build process and helps teams build, automate and deliver better apps faster. Using Gradle, we can define a different set of code and resources for each build configuration and also reuse some parts of the app that are common to all versions of your app. The Gradle and Android Plugin can be run independently from command line even without installing the Android Studio.
Complete Details on working of Gradle Execution are beyond the scope of this Android Studio Tutorial and will be covered in more advanced tutorial.
Working with GIT
Android Studio Allows you to import code samples and projects from Github repository using Android Studio’s project wizard. This makes it really easy to quickly connect to existing projects. There is the full support to Cloning Repository, Pulling and Pushing code changes to an online git repository.
Cloning Repository from Github
Cloning Repository of GIT
As shown in above picture you can Select VCS -> Checkout from Version Control -> Choose Git to clone a GIT repository.
We are not covering the complete steps to clone Git Repository as a part of this Android Studio Tutorial. We will be creating a separate article for that later.
What’s Next ??
After this, Now that you have learned the basics of Android Studio from this Android Studio Tutorial. Practice more and dig into the exciting features that we have discussed in this Android Studio Tutorial. Till then stay tuned for more tutorials.. and Don’t forget to subscribe our blog for latest android tutorials. Also do Like our Facebook Page or Add us on Twitter.