AndroidStudio: Installation and Working

Installing AndroidStudio

Installing AndroidStudio is very simple and easy steps.

  • Download latest version of AndroidStudio
  • To install, open the file named “AndroidStudio.exe”
  • Click on Next button.
  • Read the license document and accept it. Now you can go to next step.
  • Select the location to which the software installed.
  • In the next step, select the Visual Studio versions, which are configured with AndroidStudio.
  • Then install AndroidStudio.


Select Voisual Studio Version

Configuring System

 

SDK SetUp

 Ant Setup

 We need “ANT” to compile android project.

  • Download Apache Ant from Here

  • Extract the Ant Zip file (I extracted to C:\apache-ant-1.8.2)

  • Now you have to setup three environment variables.

  • After setup all 3 environment variables then check ant is working or not

    • Open Command Prompt
    • Type ant and press Enter

Results:

Buildfile: build.xml does not exist!

Build failed

 Setting Environment Variables

We need three environment variables : JAVA_HOME, ANT_HOME, and PATH. To create these Variables, do the following:

  • Right Click on My Computer icon
  • Select Advanced tab
  • Select Environment Variables
  • Select New in “user variables”

 Environment Variable 1

Name: JAVA_HOME

Value: Path of Java home (Ex: C:\Program Files\Java\jdk1.7.0\)


Environment Variable 2

Name: ANT_HOME

Value: Path to Ant home (Ex: C:\ apache-ant-1.8.2\ apache-ant-1.8.2)


Environment Variable 3

Name: PATH (If you already set path to java then add Ant path followed by a semicolon)

Value: Combination of Java Bin and ANT bin. (EX: C:\Program Files\Java\jdk1.7.0\bin;C:\ apache-ant-1.8.2\ apache-ant-1.8.2\bin)


Congratulations...
You have cofigured your system for work with android studio. Now, open AndroidStudio and enjoy with AndroidSudio...!

Work with AndroidStudio

After install AndroidStudio and configure your system, open Visual Studio.

Firstly, you should set SDK-Location. To do this, select “AndroidStudio Settings” from “AndroidStudio” menu. Here browse the location SDK location. Here you can set default build target version. Click on Apply -> Ok

Now you are ready to create android project.


Creating New Android Project

To create new android project, select “New Android Project” from File-> New

Type your project name. Note that, the project name must be unique in that folder. A project name can contain only uppercase, lowercase letters, underscore and numbers. Any other special characters are not permitted.

To create a new project, select the first option, i.e. “Create New Project in Workspace”. If you want to create a project from a build in sample, select the option “Create New project From Existing Source” and select a sample.

Creating Projects from Existing source

  • To create a project from existing sample, firstly place the android sdk in any drive other than the c drive (because of the authentication problem).
  • Select the sample in the list box, from which we create the project.
  • Browse the project location, to the sample location.
  • when you click on Ok button, the project will created in the location specified. Note that, we create the project to the sample location.

Select the Build target version you want, and also select the project location. If you want to change the properties of project, do so, from project properties tab. After making sufficient modifications, click on Ok button.

Congratulations… you have created an android project. In the solution explorer, you can see the list of files which are created by “AndroidStudio”. You can make changes to the “MyFirstAndroidProjectActivity.java” file, to modify the project as your wish.


Opening Android Project
You can also edit an existing android project using AndroidStudio. To this select the "open android project" from file -> open menu. Browse the android project solution. If you have not a solution file (.sln file), use the "Open Android Project Folder". Now, You can compile and debug the project.  

CompilingAndDebugging

Compiling and debugging are simple activities.

  • Go to "AndroidStudio" menu and "Compile the Project"
  • Then Debug the project. Debugging will creating "ProjectName.apk" file
  • Now, you can run the project.

RunningTheAndroidProject

To run the android application, we need an emulator in online mode. To this use the “invoke the Android Emulator” menu from “AndroidStudio”. The emulator may take some time, to become running mode, depending on your system. After the emulator becomes active, you can use it as normal phone.

When the emulator becomes in online mode, run the project. This will install the application in the emulator.  Click on menu on the screen. Now you can see the list of installed applications. Click on your application name to run it.

Note: One application can install one time only. So, you need to uninstall the application, to install it after modifications.

To uninstall the application

·         Quit from the application

·         click the menu in the key board

·         click on “Manage apps”

·         select the application

·         click on “uninstall” button and uninstall the application

Fig: An emulator, which is ready to run your application.



TektipsProjectLink
TekTipsKTS