Emulatory urządzeń mobilnych z systemem Android

Przed przystąpieniem do tworzenie aplikacji mobilnych konieczne jest przygotowanie środowiska testowego, w którym będziemy mogli testować oraz debugować tworzoną aplikację.

Mamy do wyboru dwie opcje:

1. Wykorzystanie fizycznego urządzenia.
2. Wykorzystanie emulatorów fizycznych urządzeń

O ile konieczne jest uruchomienie i przetestowanie aplikacji na fizycznym urządzeniu mobilny przed przekazaniem jej do sklepu „Google Play” lub „App Store” o tyle w codziennym procesie tworzenia aplikacji można wykorzystać emulatory.

Wykorzystanie emulatorów jest wygodniejsze, gdyż:
– nie musimy za każdym razem podłączać fizycznego urządzenia,
– widzimy działającą aplikację na ekranie komputera o większych wymiarach niż fizyczne urządzenie,
– możemy testować aplikację na różnych rodzajach emulowanych urządzeń (w różnych rozdzielczościach, różnych parametrach sprzętowych np. wielkość pamięci, rodzaj procesora itp.)

Należy mieć świadomość, iż emulator jest niczym innym jak stworzoną przez programistów wirtualną maszyną imitującą fizyczne urządzenie. Nie może on zatem całkowicie zastąpić testów wykonywanych na fizycznym urządzeniu.

Należy również wspomnieć, iż korzystanie z emulatorów jest wygodne tylko w przypadku gdy wykorzystują one akcelerację sprzętową. W przeciwnym razie emulator będzie działał zbyt wolno i proces debugowania oraz testowania będzie „męczarnią”.

Jeśli chodzi o emulatory urządzeń z systemem Android, to aktualnie mamy następujące opcje:
• Emulatory opracowane i udostępnianie przez firmę Google oraz Intel.
• Emulatory opracowane przez firmę GenyMotion
• Emulatory Visual Studio stworzone przez firmę Microsoft.

1. Emulatory opracowane i udostępnianie przez firmę Google oraz Intel.

Chyba najczęściej wykorzystywane emulatory do celów developerskich.
Emulatory te mają możliwość logowania się do sklepu Google Play i pobieraniu z niego aplikacji.
W celu przyspieszenie pracy emulatorów, wykorzystywany jest silnik Intel Hardware Accelerated Execution Manager (Intel HAXM), który wykorzystuje technologię sprzętową Intel Virtualization Technology (Intel VT).

Emulatory można zainstalować poprzez:

a) Instalację Android Studio.

Dostępna jest ona pod adresem: https://developer.android.com/studio/

b) Instalację lub modyfikację Visual Studio 2017
W Visual Studio Installer po wyborze poniższych opcji zostaną zainstalowane emulatory w następujących wersjach: Android 6.0 Marshmallow (Level 23), Android 7.1 Nougat (Level 25), Android 8.1 Oreo (Level 27) oraz silnik Intel HAXM.

Uruchamianie emulatorów 

Aby korzystać z emulatorów firmy Google w systemie Windows 10 należy zastosować jedną z poniższych opcji:

– wyłączyć funkcję Hype-V w systemie Windows w „Windows features”.

– dodać dodatkową opcję uruchamiania systemu Windows w trybie HyperVisor i bez trybu Hypervisor. Więcej na te temat tutaj.

– zainstalować najnowszą wersję Visual Studio 2017 w wersji co najmniej 15.8.0. W wersji 15.8.0 została wprowadzona możliwość uruchamiania emulatorów firmy Google x86 bez konieczności wyłączania funkcji Hyper-V. Więcej na ten temat: Hardware Acceleration for Emulator Performance (Hyper-V & HAXM)   
Czasami występują problemy z włączeniem opcji “Windows Hypervisor Platform”. Należy w tym wypadku wykonać dodatkowe kroki: Android Emulator Troubleshooting.

 

2. Emulatory opracowane przez firmę GenyMotion

Są to bardzo dobre emulatory, niestety nie są one bezpłatne. https://www.genymotion.com/
Na szczęście jest możliwość korzystania z nich w bezpłatnej wersji wyłącznie do celów osobistych. Można je pobrać pod adresem: https://www.genymotion.com/fun-zone/

 

3. Emulatory Visual Studio stworzone przez firmę Microsoft.

Dostępne są emulatory z systemem Android do wersji 6.0 Marshmallow (Level 23). Aby testować aplikacje na nowszych systemach Android należy zatem zainstalować emulatory firmy Google lub GenyMotion.

Emulatory te wykorzystującą oprogramowanie do wirtualizacji Hype-V firmy Microsoft. Oprogramowanie Hype-V wykorzystuje na wyłączność technologię sprzętową Intel VT.

W celu zainstalowania tych emulatorów, należy podczas instalacji lub modyfikacji Visual Studio wybrać opcję “Visual Studio Emulator for Android”:

Dodawanie kolejnych emulatorów możliwe jest poprzez aplikację “Visual Studio Emulator for Android”:

Android’s Mobile Device Emulators

Before we start creating mobile applications, we need to prepare a testing environment in which we will be able to test and debug our apps.

We have two options:
1. Use of the physical device
2. Use of physical device emulators.

It is necessary to run and test an application on a physical device before passing it to “Google Play” or “App Store”.
But in the everyday development process, we can use emulators.

The use of emulators is more convenient because:
– we do not have to connect a physical device every time.
– we can see a working application on a computer screen with larger dimensions than a physical device.
– we can test the application on different types of emulated devices (in different resolutions, hardware parameters, e.g. memory, processor, etc.).

We should be aware that the emulator is nothing more than a virtual machine created by programmers imitating a physical device. Therefore, emulators cannot replace the physical device. It can be used as a convenient help in the everyday developing process.

It should also be mentioned that the use of emulators is convenient only when they use hardware acceleration. Otherwise, the emulator will run too slowly and debugging and testing will be a “torment”.

When it comes to the emulators of Android’s devices, we currently have the following options:

• Emulators created and distributed by Google and Intel.
• Emulators created by GenyMotion.
• Emulators created by Microsoft to use with Visual Studio IDE.

  1. Emulators created and shared by Google and Intel.

Probably the most commonly used emulators for development purposes.

These emulators have the ability to log into the Google Play store and download applications from it.

In order to speed up the work of emulators, the Intel Hardware Accelerated Execution Manager (Intel HAXM) is used and it uses Intel Virtualization Technology (Intel VT) hardware.

Emulators can be installed by:

• Installation of the Android Studio IDE.
It is available at  https://developer.android.com/studio/

• Installation or modification of Visual Studio 2017

The following emulators will be installed when options below are selected in the Visual Studio Installer: Android 6.0 Marshmallow (Level 23), Android 7.1 Nougat (Level 25), Android 8.1 Oreo (Level 27) and Intel HAXM engine.

 

Launching emulators 

In order to launch Google emulators in Windows 10 we should use one of the options below:

– turn off Hype-V feature in Windows features.

– add an additional option to start Windows in Hypervisor mode and without Hypervisor mode in the Windows bootloader menu. More on this topic here.

– install the latest version of Visual Studio 2017 at least 15.8.0. From version 15.8.0, we have the option of running Google x86 emulators without having to disable Hyper-V. More on this topic:  Hardware Acceleration for Emulator Performance (Hyper-V & HAXM) 
Sometimes there are problems with enabling the “Windows Hypervisor Platform” option. In this case, you must take additional steps: Android Emulator Troubleshooting.

 

2. Emulators created by GenyMotion.

These are very good emulators unfortunately, they are not free.
https://www.genymotion.com/

However there is a way to use them in a free version only for personal purposes.
You can download it at: https://www.genymotion.com/fun-zone/

 

3. Emulators created by Microsoft to use with Visual Studio IDE.

Microsoft created emulators with Android up to version 6.0 Marshmallow (Level 23). In order to test applications on newer Android systems, you must therefore install Google or GenyMotion emulators.

These emulators use Microsoft’s Hyper-V virtualization software.
The Hype-V software exclusively uses Intel VT hardware technology.

In order to install the emulator, the option “Visual Studio Emulator for Android” should be selected in the Visual Studio 2017 Installer:


Later we can add other emulators through the “Visual Studio Emulator for Android” application: