0% found this document useful (0 votes)
23 views

Unit-2- installation and configuration of android (1)

This document outlines the installation and configuration of the Android development environment, detailing the necessary components such as the Operating System, Java JDK, and Android SDK. It covers the features of Android Development Tools, including Android Studio and emulators, as well as the differences between the Dalvik Virtual Machine and Java Virtual Machine. Additionally, it provides step-by-step instructions for installing and configuring Android Studio and SDK.

Uploaded by

Jigisha Bharambe
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views

Unit-2- installation and configuration of android (1)

This document outlines the installation and configuration of the Android development environment, detailing the necessary components such as the Operating System, Java JDK, and Android SDK. It covers the features of Android Development Tools, including Android Studio and emulators, as well as the differences between the Dalvik Virtual Machine and Java Virtual Machine. Additionally, it provides step-by-step instructions for installing and configuring Android Studio and SDK.

Uploaded by

Jigisha Bharambe
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 23

Unit2-Installation and configuration of Android

Course Outcome:

Configure Android environment and development tools.

Unit Outcomes:

2a. Describe function of the given component to operate the specified IDE.
2b. Explain the given term related to virtual machine.
2c.Explain the given basic term related to Android development tools.
2d. Describe the features of given android emulator.
2e.Describe the steps to configure the given android development environment
---------------------------------------------------------------------------------------------------------------

Contents:

2.1 Operating System, Java JDK, Android SDK


2.2 Android Development Tools(ADT)
2.3 Android Virtual Devices(AVDs)
2.4 Emulators
2.5 Dalvik Virtual Machine, Difference between JVM and DVM
2.6 Steps to install and configure Android Studio and SDK
---------------------------------------------------------------------------------------------------------------

2.1 Operating System , Java JDK , Android

SDK Operating System

• A mobile OS is an operating system for smart phones, tablets, PDAs, or


other mobile devices.
• Mobile OSs combine features of a personal computer OS with other features
usefulformobileorhandhelduse;usuallyincluding,andmostofthefollowing
considered essential in modern mobile systems;

Touch screen, cellular, Bluetooth, Wi-Fi, GPS mobile navigation, camera, video camera,
speech recognition, voice recorder, music player, etc

Java JDK

The Java Development Kit (JDK) is a software development environment used for
developingJavaapplicationsandapplets.ItincludestheJavaRuntimeEnvironment (JRE), an
interpreter/loader (java), a compiler (javac), an archiver (jar), a documentation
generator (javadoc) and other tools needed in Java development.

JVM

1
JVM (Java Virtual Machine) is an abstract machine. It is a specification that provides runtime
environment in which java bytecode can be executed.

JVMs are available for many hardware and software platforms (i.e.JVMisplatform
dependent). JVM is a part of Java Run Environment (JRE).

The JVM performs following operation:

o Loads code
o Verifies code
o Executes code
o Provides run time environment

JRE
The Java Runtime Environment (JRE) is a set of software tools for development of Java
applications. It combines the Java Virtual Machine (JVM), platform core classes and
supporting libraries.

Android SDK
Android development starts with the Android SDK (Software Development Kit).It is a
software development kit that enables developers to create applications for the Android
platform.

The Android SDK (software development kit) is a set of development tools used to
develop applications for Android platform. The Android SDK includes the following:

 Required libraries
 Debugger
 An emulator
 Relevant documentation for the Android application program interfaces(APIs)
 Sample source code
 Tutorials for the Android OS

2.2 Android Development Tools (ADT)


1. Android Studio

Developed by Google, Android Studio is an all-rounder integrated development


environmentthatallowstheAndroiddeveloperstogetwhattheydesirewithoutan
Integrated Development Environment or IDE.

AndroidhasGradle-basesupportthathasfeatureslikevisuallayouteditor,intelligent
codeeditor,real-timeprofilersandAPKanalyzer.ItactsjustlikeanyotherJavaIDEin terms
of error investigating and file hierarchy.

2
2. VisualStudio–Xamarin

Xamarin was launched in 2011 which is the best free IDE for delivering an enterprise-
quality, cross-platform approach. Xamarin supplies add-ins to Microsoft Visual
Studio that allows developers to build Android, iOS, and Windows apps within the IDE

3. IntelliJ IDEA

The framework based assistance, productivity boosters, unobtrusive intelligence,


duplicates, and inspections are provided with the IDE. Using this IDE, you can do in-
depth coding, quick navigation, and error analysis. It supports mobile app development
with the help of Java, Scala, Kotlin, and Groovy.

4. EclipseIDE

It is one of the most popular IDES of Android apps. The open-source software is free to
use. Released under the Eclipse Public License, ith old salarge community having plenty
of plugins and configurations. Highly customizable offers full support for Java
programming language and XML.

Android
Developme Languag Target RunsOn Audience License Price
ntIDEs es OS
Android Java Android Windows Experienced Freeware Free
Studio C MacOS
C++ Linux
Kotlin
Eclipse Java Android Any OS Professional Eclipse Free
C iOSLinux supportin Developers Public
C++ MacOS g Java License
C# Windows
JavaScript
Python
more
Visual C++ Cross- Windows Experienced Proprieta Freeto
Studio(with C Platform MacOS ry,Visual $2,999
Xamarin) C# Windows Linux Studio +
Visual Android Code is
Basic iOS Open
PHP more Source
JavaScript MIT
more
IntelligJ Java AnyOS Windows Professional Proprieta Freeto

3
IDEA Scala supportin MacOS Java ry, $499/y
Groovy g Java Linux Developers Communi ear
Kotlin tyEdition
JavaScript is
TypeScrip Apache
t 2.0
SQL License
NetBeans Java Cross- Windows Professional CDDL1.0 Free
C platform MacOS Developers andGPL2
C++ Linux
HTML Solaris
PHP
JavaScript
others
Komodo Java Cross- Windows Professional Proprieta Freeto
JavaScript platform MacOS Web and ry, $394+
Python Linux mobile Komodo
PHP developers Edit is
HTML Mozilla
Ruby Public
others License
Cordova HTML Cross- Windows Experienced Apache Free
CSS platform MacOS Web 2.0
JavaScript Android Linux developers License
Windows
iOS
MacOS
Ubuntu
PhoneGap HTML Cross- Windows Web Apache Free
CSS platform MacOS developers 2.0
JavaScript Android Linux License
iOS Android
Windows
Phone
App Kawa Android Windows Studentsand MIT Free
Inventor MacOS amateurs License
Linux
AIDE Java Android Android Amateurs or Proprieta Free
C Web mobile ry within-
C++ professionals app
XML purcha
HTML ses
CSS
JavaScript

2.3 Android Virtual Devices (AVDs)


An Android Virtual Device (AVD) is a configuration that defines the characteristics of an
Android phone, tablet, WearOS, AndroidTV, or Automotive OS device that you want to

4
Simulate in the Android Emulator. The AVD Manager is an interface you can launch from
Android Studio that helps you create and manage AVDs.

To open the AVD Manager, do one of the following:

 Select Tools>AVD Manager.

 Click AVD Manager in the toolbar.


To create a new AVD:

1. Open the AVD Manager by clicking Tools>AVD


Manager.

2. Click Create Virtual Device, at the bottom of the AVD Manager dialog.
The Select Hardware page appears.

5
Notice that only some hardware profiles are indicated to include Play Store. This
indicates that these profiles are fully CTS compliant and may use system images that
include the Play Store app.
3. Select a hardware profile, and then click Next.

If you don't see the hardware profile you want, you can create or import a hardware
profile.

The System Image page appears.

6
4. Select the system image for a particular API level, and then click Next.

The Recommended tab lists recommended system images. The other tabs include a
morecompletelist.Therightpanedescribestheselectedsystemimage.x86imagesrun the
fastest in the emulator.

If you see Download next to the system image, you need to click it to download the
system image. You must be connected to the internet to download it.

The API level of the target device is important, because your app won't be able to run on
a system image with an API level that's less than that required by your app, as specified
in the min Sdk Version attribute of the app manifest file. For more information about
the relationship between system API level and min Sdk Version, see Versioning Your
Apps.

If your app declares a <uses-library> element in the manifest file, the app requires a
system image in which that external library is present. If you want to run your app on
anemulator,createanAVDthatincludestherequiredlibrary.Todoso,youmightneed
touseanadd-oncomponentfortheAVDplatform;forexample,theGoogleAPIsadd-on
contains the Google Maps library.

TheVerifyConfigurationpageappears.

7
ChangeAVDpropertiesasneeded,andthenclickFinish.

NowyougetanewAVDreadyforlaunchingyourappsonit.

2.4 Emulators

TheAndroidEmulatorsimulatesAndroiddevicesonyourcomputersothatyoucantest
yourapplication on a varietyofdevices andAndroid APIlevels without needingtohave
each physical device.

TheemulatorprovidesalmostallofthecapabilitiesofarealAndroiddevice.Youcan simulate
incoming phone calls and text messages, specify the location of the device, simulate
different network speeds, simulate rotation and other hardware sensors, access the
Google Play Store, and much more.

Testingyourappontheemulatorisinsomewaysfasterandeasierthandoingsoona physical
device. For example, you can transfer data faster to the emulator than to a device
connected over USB.

TheemulatorcomeswithpredefinedconfigurationsforvariousAndroidphone,tablet, Wear
OS, and Android TV devices.

8
In short, AnAndroid emulatoris anAndroidVirtual Device (AVD) that represents a
specificAndroiddevice. You can use anAndroid emulatoras a target platform to run
and test your Android applications on your PC. Using Android emulators is optional.

LaunchtheAndroidEmulatorwithoutfirstrunninganapp

Tostarttheemulator:

1. OpentheAVDManager.
2. Double-clickanAVD,orclickRun

.
TheAndroidEmulatorloads.

While the emulator is running, you can run Android Studio projects and choose the
emulatorasthetargetdevice.YoucanalsodragoneormoreAPKsontotheemulatorto install
them, and then run them.

2.5 DalvikVirtualMachine(DVM)

As we know the modern JVM is high performance and provides excellent memory
management.Butitneedstobeoptimizedforlow-poweredhandhelddevicesaswell.

TheDalvikVirtualMachine(DVM)isanandroidvirtualmachineoptimizedformobile
devices. It optimizes the virtual machine for memory, battery life and performance.

DalvikisanameofatowninIceland.TheDalvikVMwaswrittenbyDanBornstein.

TheDexcompilerconvertstheclassfilesintothe.dexfilethatrunontheDalvikVM. Multiple
class files are converted into one dex file.

Fig.:Thecompilingandpackagingprocessfromthesourcefile

9
Thejavactoolcompilesthejavasourcefileintotheclassfile.

Thedxtooltakesalltheclassfilesofyourapplicationandgeneratesasingle.dexfile.It is a
platform-specific tool.

TheAndroid Assets Packaging Tool(aapt) handles the package in gprocess.

Difference between JVM and DVM

DVM(DalvikVirtualMachine) JVM(JavaVirtualMachine)
ItisRegisterbasedwhichisdesignedto run ItisStackbased.
on low memory.
DVM uses its own byte code and runs JVMusesjavabytecodeandruns“.class” file
“.Dex”file.FromAndroid2.2SDKDalvik having JIT (Just In Time).
has got a Just in Time compiler
DVMhasbeendesignedsothatadevice can SingleinstanceofJVMissharedwith
run multiple instances of the VM multiple applications.
efficiently. Applications are given their
own instance.
DVMsupportsAndroidoperating system JVMsupportsmultipleoperating systems.
only.
ForDVMveryfewRe-toolsareavailable. ForJVMmanyRe-toolsareavailable.

Thereisconstantpoolforevery Ithasconstantpoolforeveryclass.
application.
HeretheexecutableisAPK. HeretheexecutableisJAR.

2.6 StepstoinstallandconfigureAndroidStudioandSDK

Installation
FollowstepsbelowforcompleteinstallationandconfigurationofAndroidStudio.

Step1)DownloadAndroidStudio
YoucandownloadAndroidStudiofromthislinkorgo
todeveloper.android.comhomepageandsearchfordownloads.Chooseappropriate
platform either for windows, mac or linux. Following are the pre requirements for
windows operating system.
Pre-requirements
 Microsoftwindows7/8/10(32or64bits)
 Minimum3GBRAM(recommended8GB)
 2GBdiskspace
 1280x800minimumscreenresolutionsize
 Intelprocessorforacceleratedemulator
 AndroidSDK

10
Note:Ifyoudon’thaveAndroidSDK,youcandownloadwithAndroidstudio.Gotothe end of
download’s page and find android-studio-bundle-162.4069837-windows.exe it
includes SDK also.
Step2)Run.exefile
Nowthenextstepistolaunch.exefileyoujustdownload.Followingscreenwillappear

Step1:Run.exe file
ClicknextandselectAndroidSDKcheckedifyoudon’thaveitalready. Betteristoleave the
default settings.

MakesureAndroidvirtualdeviceisalsochecked.

11
Step 2: Choose components
Nextstepistoacceptlicenseandagreement.ClickonIAgree

Step3:Acceptlicense
Next step is to set location of installation. Please make sure your disk has minimum
requiredspacebeforeclickingonNext.ForAndroidStudioinstallationlocationmust

12
haveatleast500MBfreespace.ForAndroidSDKinstallation,selectedlocationmust have at
least 3.25GB free space.

Step4:Installlocation
Nextstepistochoosethestartmenufolder,whereyouwanttocreateshortcut.Ifyou don’t
want to create a shortcut just mark Do not create shortcut.

13
Step5:Choosestartmenufolder
AndhitInstallbutton.
Itwillstartinstallation.Onceit’sdonefollowingwindowwillappear.

Step6:Finish
Thisinformsyouinstallationhascompleted.ClickFinish.MakesureStartAndroid Studio is
checked. Following splash screen of Android Studio will appear.

Step7:AndroidStudioSplashScreen
Step3)ConfigureAndroidStudio

14
WhenyourunitforthefirsttimeitwillaskforAndroidStudiosettings.

Step8:Importsettings
Ifyoudon’thaveanyprevioussettingsclickonthesecondoption(Idon’thavea previous
version of Studio or I don’t want to import my settings).

Selectathemeandclicknext.

Step9:Selecttheme

15
Attheveryfirstrunitneedstodownloadsomenecessarycomponents,waittillit completes.

Step10:Downloadcomponents
And it’s all done.

16
Step 11: Done
ClickonFinishandstartbuildingyourAndroidapps.
IntroductiontoAndroidStudioUserInterface
Android Studio is an Integrated Development Environment (IDE). You have seen
downloadandinstallationinthistutorial.Let’slearnsomebasicsofAndroidStudio. Here is
the a screenshot of a running Android studio.

17
AndroidStudioscreen
Redmarkshows

1:Toolbar-Itiscollectionofmanytoolslikecut,copy,paste,rundebugandothers. 2:
Navigation bar- It helps you to navigate through the recent open files of your
project.
3:Projecthierarchy-Itisthehierarchyofyourproject’sfolders.
4:ComponentTree-Itshowscomponentusedinanactivityintheformofatree structure.
5:Propertieswindow-Itshowspropertiesofselecteditemonthescreen.
6:Layouteditor-Itshowsgraphicallayout,howyourappwilllooklike.
7:Palettewindow-Palettewindowshowscomponent,layouts,andwidgetsavailable in
Android Studio.

CreateanAndroidproject

ThislessonshowsyouhowtocreateanewAndroidprojectwithAndroidStudio,andit
describes some of the files in the project.

TocreateyournewAndroidproject,followthesesteps:

1. InstallthelatestversionofAndroidStudio.

18
2. IntheWelcometoAndroidStudiowindow,clickStartanewAndroidStudio
project.

Figure1.AndroidStudiowelcomescreen
Ifyouhaveaprojectalreadyopened,selectFile>New>NewProject.
3. IntheChooseyourprojectwindow,selectEmptyActivityandclickNext.
4. IntheConfigureyourprojectwindow,completethefollowing:
 Enter"MyFirstApp"intheNamefield.
 Enter"com.example.myfirstapp"inthePackagenamefield.
 Ifyou'dliketoplacetheprojectinadifferentfolder,changeitsSavelocation.
 SelecteitherJavaorKotlinfromtheLanguagedrop-downmenu.
 SelectthecheckboxnexttoUseandroidx.*artifacts.
 Leavetheotheroptionsastheyare.
5. ClickFinish.

Aftersomeprocessingtime,theAndroidStudiomainwindowappears.

19
Figure2.AndroidStudiomainwindow

Nowtakeamomenttoreviewthemostimportantfiles.

First,besuretheProjectwindowisopen(selectView>ToolWindows>Project)and the
Android viewis selectedfromthe drop-down list at the top ofthatwindow. Youcan then
see the following files:

app>java>com.example.myfirstapp>MainActivity

Thisisthemainactivity.It'stheentrypointforyourapp.Whenyoubuildand run your


app, the system launches an instance of this Activity and loads its layout.

app>res>layout>activity_main.xml

ThisXMLfiledefinesthelayoutfortheactivity'suserinterface(UI).Itcontains a
TextView element with the text "Hello, World!"

app>manifests>AndroidManifest.xml

Themanifestfiledescribesthefundamentalcharacteristicsoftheappand defines
each of its components.

GradleScripts>build.gradle

Therearetwofileswiththisname:onefortheproject,"Project:MyFirstApp," and one


for the app module, "Module: app." Each module has its
ownbuild.gradlefile,butthisprojectcurrentlyhasjustonemodule.Useeach

20
module'sbuild.filetocontrolhowtheGradlepluginbuildsyourapp.Formore
information about this file, see Configure your build.

Runyourapp

Intheprevioussection,youcreatedanAndroidappthatdisplays"Hello,World!"You can now


run the app on a real device or an emulator.

Runonarealdevice

Setupyourdeviceasfollows:

1. ConnectyourdevicetoyourdevelopmentmachinewithaUSBcable.Ifyoudeveloped on
Windows, you might need to install the appropriate USB driver for your device.
2. PerformthefollowingstepstoenableUSBdebuggingintheDeveloper
options window:
a. OpentheSettingsapp.
b. IfyourdeviceusesAndroidv8.0orhigher,selectSystem.Otherwise,proceedtothe next
step.
c. ScrolltothebottomandselectAboutphone.
d. ScrolltothebottomandtapBuildnumberseventimes.
e. Returntothepreviousscreen,scrolltothebottom,andtapDeveloperoptions.
f. IntheDeveloperoptionswindow,scrolldowntofindandenableUSBdebugging. Run

the app on your device as follows:

1. InAndroidStudio,selectyourappfromtherun/debugconfigurationsdrop-downmenu in
the toolbar.
2. Inthetoolbar,selectthedevicethatyouwanttorunyourapponfromthetargetdevice drop-
down menu.

21
Figure1.Targetdevicedrop-downmenu

1. ClickRun .
AndroidStudioinstallsyourapponyourconnecteddeviceandstartsit.Younowsee "Hello,
World!" displayed in the app on your device.

Tobegintodevelopyourapp,continuetothenextlesson.

Runonanemulator

Runtheapponanemulatorasfollows:

1. InAndroidStudio,createanAndroidVirtualDevice(AVD)thattheemulatorcanuseto install
and run your app.
2. Inthetoolbar,selectyourappfromtherun/debugconfigurationsdrop-downmenu.
3. Fromthetargetdevicedrop-downmenu,selecttheAVDthatyouwanttorunyourapp on.

22
Figure2.Targetdevicedrop-downmenu

4. ClickRun .
AndroidStudioinstallstheappontheAVDandstartstheemulator.Younowsee"Hello,
World!" displayed in the app.

Revision Diagram

Android
Studio
Gradle
FlowUp
Geney
Motion
Game
Maker
etc.

23

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy