Preparing The Environment To Android Programming and Starting the First Project

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
    2. Android Studio
    3. Genymotion
  2. Starting First Project
  3. Running The Project
    1. Running On Genymotion Simulator
    2. Running On a Real Device

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)

Screen Shot 2015-10-05 at 11.03.42


Select installation file depends on your system. Don’t forget select ‘Accept Licence Agreement’.

Screen Shot 2015-10-05 at 11.04.14

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)

Screen Shot 2015-10-05 at 13.51.14


Agree terms and conditions and download it.

Screen Shot 2015-10-05 at 13.53.30


Run downloaded setup file and after installation, open Android Studio.You should see a menu like this:

Screen Shot 2015-10-05 at 14.03.46

3. Genymotion

So you have enough for developing but you need a device to test your applications. In this case, you have options :

  • Using virtual devices created from Android studio (its initialization and running the applications is very slow,not recommended)
  • Using real android device (It is recommended and explained how to do it under title ‘Running The Project’)
  • Using emulator like Genymotion provides us (It is also recommended because it is faster than a virtual device)

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).

Screen Shot 2015-10-05 at 14.21.3633


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):

Screen Shot 2015-10-05 at 14.26.43

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’

Screen Shot 2015-10-06 at 16.32.04


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.

 

Screen Shot 2015-10-06 at 16.35.00


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.

Screen Shot 2015-10-06 at 16.54.08


 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.

Screen Shot 2015-10-07 at 15.42.54

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’

Screen Shot 2015-10-07 at 16.24.51


Select a device (I choosed Galaxy S4 Api 19) and Click Next

Screen Shot 2015-10-07 at 16.27.19


Click Next again and wait until progress is finished.

Screen Shot 2015-10-07 at 16.29.04


So you have a S4 as simulator. Back to Genymotion screen,select S4 and start it. The simulator screen should come like below.

Screen Shot 2015-10-07 at 16.33.20


Back to Android Studio and run application with green arrow button.

Screen Shot 2015-10-07 at 16.34.59


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.

Screen Shot 2015-10-07 at 16.37.34


 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.

Screenshot_2015-10-07-20-20-24


Go Developer Option and check Usb Debugging

Screenshot_2015-10-07-20-20-38


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.

2 responses on “Preparing The Environment To Android Programming and Starting the First Project

  1. Pingback: Showing Toast on Button Click | Learn Android

  2. Pingback: Working On Layouts | Learn Android

Bir Cevap Yazın