220241-MAD Unit2 (1)
220241-MAD Unit2 (1)
220241-MAD Unit2 (1)
An Android Virtual Device (AVD) is an emulator that simulates the configuration and
behaviour of an Android device. It allows developers to test their applications on a variety of
Android device configurations without requiring physical devices.
Purpose:
Testing and Debugging: AVDs enable developers to test their apps on different
Android versions, screen sizes, resolutions, and hardware configurations,
ensuring compatibility across a diverse range of devices.
Emulating Device Features: Developers can use AVDs to simulate various device
features such as cameras, sensors, and network conditions during testing.
Efficient Development: AVDs contribute to a more efficient development process
by providing a quick and cost-effective way to identify and address issues without
the need for multiple physical devices.
d. Explain Android emulator.
Android emulator is responsible for running,debugging and testing the android application.
• An android sdk comes with a virtual mobile device emulator that runs on the
computer.
• The Android emulator mimics all the hardware and software features of a typical mobile
devices except that it cannot place annual phone calls
• It provides selection of navigation and control keys which we can press using out mouse
keyboard to generate events for our applications.
• We can select the version of android system we want to run in our emulator.
e. Explain Dalvik Virtual Machine (DVM) in detail.
The DVM (Dalvik Virtual Machine) is the virtual machine that was used by the Android
operating system prior to Android 5.0 (Lollipop). It was specifically designed to run
applications written in the Java programming language on Android devices.
Here are some key details about the DVM:
• Purpose: The DVM was developed as a part of the Android platform to execute
Android applications efficiently. It is optimized for mobile devices with limited
resources, such as memory and processing power.
• Bytecode Format: The DVM executes bytecode, which is the compiled form of Java source
code. However, the DVM uses a specialized bytecode format called Dalvik Executable
(DEX) format. The DEX format is optimized for smaller file sizes and efficient memory
usage.
• Register-based Architecture: The DVM is a register-based virtual machine, meaning it
uses a set of registers to store and manipulate data during program execution. It differs from
stack- based virtual machines like the Java Virtual Machine (JVM), which operate on a stack
structure.
• Memory Management: The DVM employs automatic memory management through
garbage collection. It automatically frees memory that is no longer needed by the application,
allowing developers to focus on writing code without explicitly managing memory allocation
and deallocation.
• Just-In-Time (JIT) Compilation: The DVM initially used a technique called "Just-In-
Time" (JIT) compilation, where certain parts of the application's bytecode are dynamically
compiled into machine code at runtime for improved performance. This allows frequently
executed code to be optimized for the specific device architecture.
• Application Isolation: Each Android application runs in its own instance of the DVM,
providing a level of isolation and security between different applications. This means that
applications cannot directly access each other's memory or resources.
• Optimization Techniques: The DVM employs various optimization techniques to
improve performance, including instruction packing, constant pool reduction, and
efficient garbage collection algorithms.
f. Differentiate between DVM and JVM.
Dalvik Virtual Machine (DVM) Java Virtual Machine (JVM)
It is Register based which is designed to run It is Stack based.
on low memory.
DVM uses its own byte code and runs ".Dex" JVM uses java byte code and runs ".class"
file. From Android 2.2 SDK file having JIT (Just In Time).
Dalvik has got a Just in Time compiler.
DVM has been designed so that a device Single instance of JVM is shared with
can run multiple instances of the VM multiple applications.
efficiently. Applications are given
their own instance.
DVM supports Android operating system JVM supports multiple operating systems.
only.
For DVM very few Re-tools are available. For JVM many Re-tools are available.
There is constant pool for every It has constant pool for every class.
application.
Here the executable is APK. Here the executable is JAR.