Let’s conquer your fear of software development by running your first android app. It’s easier than you think, I promise.
Table of Contents
Target Audience – For Whom This Blog Is Written
- Curious to start android app development
- Introduction to Native Application Development
- Learn the benefits of Native Application Development
- Learn the features of Android Studio
- Want a quick guideline to download, install, and configure Android Studio on their computer.
- Want to learn quick tips and tricks with Android Studio to optimize their app development process
- Searching for necessary computer specifications to install Android Studio.
- Quick Introduction to Android Studio Interface
- Install And Run your first hello world application on Android Emulator and also in your physical device connected with USB or wifi.
Introduction And Benefits Of Native App Development
There are lots of definitions of the native applications over the web, which are very very technical. Thus new developers pass a hard time understanding what is a native application. So let’s keep it simple and non-technical.
Developed for a specific platform E.g: Developing native android application means it will only run on android mobile devices. Android, iOS, Windows are three major mobile operating systems. If you write a separate code for each mobile platform, then it is called a native application for that specific platform. In a simple scenario, if John, a mobile application developer, writes an application that can be only run on Android smartphones, then he can say that he has written a native android application.
It’s also possible to develop an application only one time and run it in every smart-phone running on Android, iOS, Windows. As that type of application is not developed for any specific mobile platform, that’s why that application is not a native application. They are called hybrid applications.
Developers have to use JAVA or KOTLIN for native android application development. In our case, we will use java for android development.
There are several benefits of developing native applications over hybrid applications. Some have listed below.
- Native applications are very fast.
- They are easily approved on app stores. E.g: Native application for Android can be easily approved on Google Playstore
- Native apps are very interactive and run smoothly.
- You can use all the features of the phone. You can work with any part of the hardware easily. E.g: Developers can use GPS, compass, accelerometer, or other sensors data, microphone, etc easily if they are building a native application.
- Native apps are smaller than hybrid apps(non-native or cross-platform apps)
All Features And Benefits Of Using Android Studio
Android Studio is an IDE or Integrated Development Environment. Using Android Studio, a developer can build apps for Android phones, tablets, Android Wear, Android TV, and Android Auto. It is developed by Google. It comprises various useful tools like Android Virtual Device Manager or AVD and the Android Device Monitor.
Android Studio releases update very often to give developers the most enhanced experience possible. You can write code in JAVA or KOTLIN and design customized UI using dropdown elements as well as writing code in XML. That’s amazing flexibility for developers and designers. A large number of developers use Android Studio that means you won’t face much problem if you stuck somewhere in your journey.
Let’s see some quick features of Android Studio that impress developers.
- Code editor with rich features.
- You can see pre-declared classes and functions documentation from the code editor while coding
- All necessary features essential for smoothing coding experience is present in Android Studio
- Provides an environment where you can develop an application for all android devices
- Code testing, debugging, performance monitoring facilities available
- Provides built-in support for Google Cloud Platform.
System Requirement
The system requirement for your computer to run Android Studio is provided by the official site of Android App Developers.
Minimum Requirement on Windows
- OS: Microsoft Windows 7/8/10
- CPU: No requirements given from the official website
- RAM: 4 Gigabytes
- Disk Space: 2 Gigabytes
- Screen Resolution: 1280 x 800
Recommended system requirement on windows
- CPU: No requirements given from the official website
- RAM: 8 Gigabytes
- Disk Space: 4 Gigabytes
Despite above-mentioned requirements, you should have
- CPU having clock speed 2.5GHz or more with virtualization enabled.
- SSD (minimum 256 Gigabytes )will be a performance booster. Android Studio doesn’t run smoothly with HDD. Recommended 4 Gigabytes disk space for initial installation. You will need to download and install more packages with time. You have to install multiple emulators which will consume much disk space over time. Your all software, along with your android studio SDKs, emulators are installed inside a single drive, most probably in C drive. With time, you will install more software and need more disk space. Buying an SSD is a long term investment that will serve you years after years.
- A large monitor is helpful for coders to write codes and debug them. It’s not mandatory but useful
Install Android Studio On Windows 10
- Download Android Studio from the official website. Here is the link.
- Before Downloading Android Studio,Agree to Terms and Conditions
- Make sure “virtualization” is turned on.
- Run Android Studio as Administrator permission.
- Allow User Access Control
- Wait until setup finishes loading.
- Click Next.
- Make sure you have selected to install “Android Virtual Device” and click next.
- Leave the installation location as it is and select next.
- Untick “don’t create shortcut” and select install
- Wait Until installation completes.
- After completing the installation, the “Next” button becomes clickable. Click on Next.
- Give a tick mark on “Start Android Studio” and select “Finish”.
- You can see Android Studio is starting for configuration
- Select Next to configure the development environment.
- Select setup type “Standard” and click Next
- Choose a UI theme that you like. We will go with “light” them but you can choose “dark” , if you want. After that select “Next”.
- If any warning is shown then change the folder location as shown in the picture. This warning is shown due to the presence of whitespace in the folder path. If no warning is shown then skip this step.
Change Your Android SDK Location
- Give tick in the tickbox to install components as shown in the picture and Select Next.
Please choose separate instruction for Intel and AMD CPUs, as shown in the picture. Intel HAXM doesn’t work with AMD processors, in fact, gives errors. That’s why you should avoid installing Intel HAXM on AMD processor and only install them if your computer uses Intel CPUs. - Select Finish
- Wait until Android Studio Finishes downloading Components. Make sure you are connected with the internet as components are being downloaded from the internet.
You can use see details option to see which components are being downloaded.Make sure all the components are successfully downloaded and installed without any error.
- After Completing Download Click Finish.
- Now This window will show up.You can start your project from here.
Create Your First Hello World Project
- Create a new project
- Select Empty Activity and Click On Next
- Give a name of your application. Application name should have white space between words.Make sure first letter of every word, separated by white space, is capital.
Use “Reverse Domain Name” to create package.Let make this matter clear by an example. Lets assume , the company domain name of the application is “samsofts.com” where “com” is top level domain and “samsoft” is second level domain. By using the reverse domain name , we can set our package name “com.samsofts.currencyconverter”. So the general format is for package name is
“TopLevelDomain.SecondLevelDomain.ApplicationName” .Select a location of your choice to save your project files. Make sure there is no whitespace in the file path.We have seen how to change file paths before in “Installing and Configure Android Studio On Windows 10” section ,while installing Android Studio, in the same page that you are visiting now.
Select “Java” Language and leave the minimum SDK as default (15) and Click on Finish.
- Wait while Gradle Build is running.Wait until it completes.
Enable Debugging Mode On Android Phone Run Hello World Application On Physical Device
If you want to run your application on your physical device, then you have to follow the steps listed below. You can follow this method if your computer has a weak processor and RAM less than 8 Gigabytes.
- To run an application on your android device, developed using Android Studio, you must enable “USB debugging”. “USB debugging” is disabled by default.
- Navigate to Build number and tap 7 times to enable developer options.Android 9 and higher: Settings > About Phone > Build Number
Android 8.0.0 and Android 8.1.0 (API level 26): Settings > System > About Phone > Build Number
Android 7.1 and lower: Settings > About Phone > Build Number - Now Navigate to Developer options and enable USB DebuggingAndroid 9 and higher: Settings > System > Advanced > Developer Options > USB debuggingAndroid 8.0.0 and Android 8.1.0 (API level 26): Settings > System > Developer Options > USB debuggingAndroid 7.1 and lower: Settings > Developer Options > USB debugging
- Now after connecting your android phone with your computer, you might encounter a prompt titled “Allow USB debugging?”. Just simply select Ok.
- Now you can see your device listed on the drop-down menu. Select your physical device.
- Click Run and your application will be built and installed on your Android Phone.
Create Android Virtual Device And Android Phone Run Hello World Application On Emulator
If you have a powerful computer and you want to test your applications on an emulator rather than connecting with your physical device, then you can follow this method.
- Open Android Virtual Device Manager. Create a Virtual Device.
- Select Any Pre-defined device of your choice. Here, we will select Pixel 2
- You can download any recommended image if there is no pre-downloaded image and select that image after download it. Then click on Next.
Or, You can select x86 Image and look for a pre-downloaded image file. If no pre-downloaded x86 image is found then download one and then select that.
Avoid selecting Deprecated images.
- Leave every configuration as it is and click on Finish.
- Select Your Device And Run Hello World Application
Run Hello World Application On Physical Device Connected With Wifi
You can install and run any android application on your physical device without USB connection if your computer and mobile are connected to the same wifi network. To do so, please follow the instructions.
- Navigate to gettings.
- Navigate to Plugins. From Market Place Download and install “Android wifi ADB”, after than restart Android Studio.
- Make sure your computer and android device is connected with same wifi network. Connect your Android Phone with computer , for the first time.
- Select Android wifi ADB , connect with your android device and after it says connected, remove the usb cable connection between your computer and smartphone
- Now simply select your physical device from the drop-down menu and run it.
- Your android application will install and run in your android device. Thus you can run an android application on a smartphone from Android Studio without connecting your smartphone through USB.
- Select Your Device And Run Hello World Application.
Top Tips And Tricks For Getting Most Out Of Android Studio
Every tips and trick mentioned below, images are provided as an example for better understanding.
- Search Anything In Everywhere: It enables you to find classes, functions, files (assets, layout files, image, and audio resources) containing the letters of the searched word. Press shift key twice (On Windows and Mac ) and search everywhere menu will pop up.
- Fast And Easy Documentation Lookup: Instead of searching documentation for pre-defined classes and functions on the browser, you can check for the documentation on android studio. To check the documentation of pre-defined classes or functions, highlight that class or function and press Ctrl+Q (On Windows) or Command+J (On Mac) and the documentation will popup. If the documentation is not popping up, then you have to download documentation from SDK manager discussed on Run And Configure Android Studio After Installation For Smooth App Development Experience section of this blog.
- Useful Actions(e.g Run, Instant Run, Find, Replace, etc…) Lookup And Shortcut Finder: If you want to find certain quick actions like Run, Instant Run, Find, Replace, etc… then you can use Find Action menu. Just press CTRL+Shift+A(On Windows) or Command+Shift+A (On Mac) and Find Action Menu will appear. Just search for the action name and the action and related other actions will appear.
- Automatic Override Methods: While extending the pre-defined classes, certain methods need to be overridden. Android Studio can generate boilerplate codes for you. Press Ctrl+O (For Windows) or Command+O (For Mac) and a list of methods that you can override will popup.
- Collapse Blocks Of Codes: You don’t look, neither you don’t work with the entire codebase at a time. You can collapse every block of codes and you can manually expand only those blocks you are currently working. It improves your coding experience.
- Automatic Code Reformatting: Instead of formatting your code manually, you can format your code automatically by pressing CTRL+ALT+L (on Windows) or Command+Option+L (on Mac).