How to install Android Studio on your PC and create the first application
Android Studio is the main software tool to develop native Android applications. It has an intelligent IDE and facilitates tasks such as coding, debugging and deploying in a very user-friendly manner. So, as the first post of CodingCrane blog, I would like to show you how to install Android Studio on your computer and start the first android application. Android Studio is the main software tool to develop native Android applications. It has an intelligent IDE and facilitates tasks such as coding, debugging and deploying in a very user-friendly manner. So, as the first post of CodingCrane blog, I would like to show you how to install Android Studio on your computer and start the first android application. First of all, we need to download the Android Studio setup. We can download the setup from the official download page https://developer.android.com/studio/index.html. Usually, Android Studio setup is really heavy. It is about 1.6–2.0 GB. When I was downloading the complete setup last time it was about 1.9GB as I remember. The above image shows how the download page looks like when at the moment of this blog post being written.
After download it, you can install it just by double-clicking on it. Nothing specific. However, the setup will take some time to install. After completing the installation, let’s check how to start a new Android app using it. It’s needless to say that first of all you have to run the software. You will see something like the below image.
Then select ‘Start a new android studio project’. Then you will see another window which asks you to give a name for the application and the project location.
Then you will go to a window which asks you to give the minimum SDK. Here you have to select the minimum API level that your application will support. It’s better to select something like API 18–20. If you select a higher API level as your minimum level, you would not be able to run your application of devices which have lower APIs. In other hands, if you select a too low API level, you won’t be able to use or add some features which are available in recent android apps.
After this step, you will see one or two windows. You only need to click on ‘Next’ button. Then you will see a window where you can select the type of Main activity of your project. There options such as Blank activity, Empty activity, Login activity, Google maps activity and etc. For your first app, I recommend you to start with a Blank activity. Empty activity is also good in this phase but I personally think Blank activity allows beginners to catch things more fastly than empty activity. However, there is no need to confuse with other activity types for now. After selecting the activity type, it will take few minutes to build your first application.
Then, it’s better to download required SDK platforms to build applications. You can find the download location from File-> Settings-> Appearance & Behavior-> System Settings-> Android SDK. My personal opinion is, it’s better to download at least 3 APIs. Those three APIs are the latest API, API of the android os of your mobile phone, and previous API version of your device’s os. Here is a list of recent Android operating systems and there API levels,
- Jelly Bean(Android 4.1–4.3) — API 16–18
- KitKat(Android 4.4) — API 19–20
- Lollypop(Android 5.0–5.1) — API 21–22
- Marshmallow(Android 6.0) — API 23
- Naught(Android 7.0–7.1) — API 24–25
That is almost it, now you have created your first application which will only show ‘hello world’ when you are running it. Next, we have to check how to run this application. Actually, there are several methods to do this. Here are the ways that I’m using to run my applications.
- Use the default emulator
An emulator is something like a virtual android phone. You can just simply click on the run button in the Android Studio IDE and run the application. Also, can change the target emulator before running the app and check how it shows on different devices. However, it will take some time to build the emulator. You have to be little patience at this phase.
- Use Genymotion emulator
Other than using the default emulator, you can also download and install a faster emulator to your IDE. One of most famous such emulator is Genymotion. You can download it from https://www.genymotion.com/download/ and install it. After it is being installed, you need to open Android Studio and go to File->Settings->Plugins. There you have to search for the Genymotion plugin and install it. Then it will appear on your IDE. Now you have to click on that and do few settings as it suggests. I will do a more detailed post about this later. However, after this point, it won’t be difficult to configure Genymotion. You can find some youtube videos related to integrate Genymotion emulator to Android Studio.
- Run on a mobile phone
This is my favorite and fastest method. However, you can’t do this if you haven’t an android phone. Also, your device’s API level should be higher than the minimum API level which your application supports. First of all, you need PC drivers for your device. You have to search matching drivers to your device and install them on your computer. After it, you have to plug in the mobile device using a USB cable and click on the run button of the app. Then you will see a box which shows available emulators and your mobile device. Since you are trying to run the app on your physical device, you need to select the mobile device from the list. After few seconds the app will installed and opened on your device.
That’s it. Now you can check how your app works on an emulator or on your own Android device.