What is Android Studio
Android Studio powered by the IntelliJ platform is an integrated development environment (IDE) and is officially recognized for developing androidapplications. Its foundation lies on JetBrains' IntelliJ IDEA and is specialized for the development of android applications.
It is currently available to install on Windows, Linux, and macOSoperating systems. The Eclipse Android Development Tools which was earlier considered as key IDE for native Android application development was substituted by Android Studio.
On May 16, 2013, Android Studio IDE was disclose the Google Input/Output conference. In May 2013, it was previewed for early access in version 0.1 and then launched in beta testing starting from version 0.8 in June 2014.In December 2014, the first stable build was released starting from version 1.0.
Kotlin substituted Java as Google's preferred programming language for Android app development on May 7, 2019. But currently, Java is still supported by Android Studio, as is C++ (for native coding).
Features:
- Anadjustable Gradle-based build system
- It provides acombined environment in which you can develop for all Android devices such as phones, watches, tablets, etc.
- Able to push changes to your running app without building or creating a new APK
- Provides code templates and Git integration to help you import sample code and build common app features
- A high-speed and fully featured emulator
- It provides lint tools for determining performance, version compatibility, and other issues
- Vast testing tools and frameworks for your app testing purposes
- Integration with Google Cloud Platform (GCP), making it easy to deploy Google App Engine and Google Messaging services
- Provides C++ and NDK support
- Provides Visual layout editor
- Plug-in architecture used to extend Android Studio with plugins
Creating a new Android Project:
We can create a new Android project by following these steps:
- Use the following link to download and install the latest version of Android Studio. https://developer.android.com/studio#downloads
- After installing in the Welcome to Android Studio window, click on Create a new project button.
Android Studio welcome screen
- If you have an existing project opened, select File -> New -> New Project option and follow the remaining steps.
- Then the Select a Project Template window appears and in this select Empty Activity and click on the Next button.
Select a Project Template Window
- Now in the Configure your project window, you need to complete the following steps:
- Enter your project name as per your requirement in the Name text field.
- Enter "com.example.projectname" in the Package name text field. (In the latest versions of Android studio, it auto generates the package name)
- If you may want to store the project in a different location, change its Save location as per your need.
- Select either Kotlin or Java programming language from the Language drop-down menu.
- Select the minimal version of Android that your app will support in the Minimum SDK drop-down menu.
- If the app will need legacy library support, mark the Use legacy android.support libraries checkbox.
- Leave the other options unchanged.
Configure your Project Window
- Click on the Finish button.
It may require some seconds to set up your project to bring up the Android Studio main window.
Android Studio might take a moment to review and download the most important files such as gradle files and several dependencies.
Android Studio Main Window
Initially, check that the project window is open (choose [View] > [Tool Window] > [Project]) and make sure the Android view is selected in the drop-down list at the top of the window.
You can see the structure of the project and the following files:
- app > java > com.example.projectname>MainActivity: By default, it's the entry point for your app. When you build and run your application on an emulator or your device, the system will create an instance of this Activity and will load its respective layout.
- app > res > layout > activity_main.xml: This XML file defines the design for the activity's user interface (UI) which shows how it will be displayed on a user’s screen. By default, it contains a TextView with the text "Hello, World!"
- app > manifests > AndroidManifest.xml:The manifest file describes the basic characteristics of the app and the required permissions such as Location or Internet access permissions and defines each component.
- Gradle Scripts:In this there are 2 build.gradle files:
- Project level, "Project: My First App," and
- App module level, "Module: app."
Each module of the android project has its own build.gradle file. We can use each module's build.gradle file to control how the Gradle plugin builds your app.