In this tutorial, we will see all environment installations for Android developing and start first project to learn more about project hieararchy – elements.
1. Installation for Environment
1. Java Development Kit
As you know, Java is used for Android development. If you think your system has java development kit (jdk) you can go next step. If you don’t, you can download it from here
Click on Java Platform (JDK)
Select installation file depends on your system. Don’t forget select ‘Accept Licence Agreement’.
When downloading finished, install it properly.
2. Android Studio
After JDK installation, we need IDE of Android development which is Android Studio. It can be download from here
Click Download Android Studio Button.(Best Android Studio version is selected automatically for your machine)
Agree terms and conditions and download it.
Run downloaded setup file and after installation, open Android Studio.You should see a menu like this:
So you have enough for developing but you need a device to test your applications. In this case, you have options :
You can download Genymotion from here. Scroll down on opened page and select proper version for your machine (Sign up by Genymotion is necessary before downloading).
Run downloaded setup file and after installation run Genymotion, you should see the menu like this (Ignore if ‘Your virtual devices’ list is empty, we will add a device on running the project step):
2. Starting First Project
If you are here, you have finished all installations. We can start an Android project right now.
Open Android Studio and Click ‘Start a new Android Studio project’
I have to explain some points on this screen:
Application name : Obviously app name. You can rename in project don’t worry.
Package name : It is generated from company domain. Consider the package name as an id of application. So every application has an id on play market and their ids are their package name. You can rename this with clicking ‘Edit’ button. You can also do it in project.
Project Location : It is the location of your project files. Root directory name is generated from application name but you can change it. Application name and Root directory name do not have to be the same.
Select minimum sdk of your aplication. Minimum sdk means when your application released on market, it can be used by only devices has minimum sdk and higher. Click Next.
Select Empty Activity and click Next.
Leave this screen as itself and click Finish. I will explain activities later.
When finished, below screen is shown. Let me introduce project elements we use frequently at first stages.
1) com.mskurt.firstproject : This folder contains all java files. So you will write all java codes under this folder.
2) res : This folder contains all resources which is used by application. Layouts, images, themes, colors, strings…etc.
3) AndroidManifest.xml : This xml file is the manifest of application.In manifest, you can declare application’s theme,permissions,activities,services…etc.
3. Running The Project
Finally we can run the application. We need an android device or a simulator to do this.
1. Running on Genymotion Simulator
Open the Genymotion and click ‘Add’
Select a device (I choosed Galaxy S4 Api 19) and Click Next
Click Next again and wait until progress is finished.
So you have a S4 as simulator. Back to Genymotion screen,select S4 and start it. The simulator screen should come like below.
Back to Android Studio and run application with green arrow button.
Wait for building, at the end you should see below frame. It asks intended device to run application. If you check ‘use same device for future launces’, you pass this stage for next runnings.
Check your simulator
2. Running On a Real Device
Connect an android phone to your computer with usb. You need to open Usb debugging mode to run your application. To do that, go to Settings on your phone and find Developer Option.Developer Option menu is hidden by default on Android 4.2 and newer. To make it visible, go to Settings > About phone and tap Build number seven times. When you open it , you can see Developer option on previous screen like below.
Go Developer Option and check Usb Debugging
After all, you can run application on your android phone. Click run button, Android Studio should detects your phone and add to device list on running stage.
Some users may have problems with real device debugging issue so I suggest this article from developer.android.com.
Thats all, see you in next tutorial.