This guide aims to assist developers to install and configure an android emulator that will communicate with localy running issuers/verifiers.
It is assumed that you have locally running issuer and/or verifier. You will also need to have a local host-file with a line mapping a hostname to your local ip.
Example:
127.0.0.1 demo-wallet-issuer
You will also need to install Android Stuido (preferably the latest version)
You will need an appropriate Device (AVD), that is one that doesn't contain Google API's
, this is important, since Devices's with Google API's
cannot be run in writable mode.
You can open the Device manager from your Tools
menu in Android Studio.
In your device manager, click the +
to create new device. You will now get a list of hardware to select from. Pick one where the Play Store
column is empty, and install this.
- Open a terminal, and navigate to your Android SDK directory. (The location can be found by opening
SDK Manager
from theTools
menu in Android Studio) - Open the emulator subdirectory
- List your current installed emulators by running
.\emulator.exe -list-avds
(on windows) - Run the emulator you just installed in writable mode, by using a command like
.\emulator.exe -writable-system -avd Pixel_6_Pro_API_35
- Open a new terminal, and navigate to the
platform-tools
subdirectory in you Android SDK directory - you should find an application in here namedadb
- Get root access by running
.\adb.exe root
- Remount filesystem with root access by running
.\adb.exe remount
- Get your device default host-file content by running
.\adb.exe shell cat /etc/hosts
- Create a new hosts file with the default content and add your own line. Note that your local computer is accessible at ip 10.0.2.2 inside the emulator.
Add a line looking something like this:10.0.2.2 demo-wallet-issuer
- Push your new hosts file to the device, replacing in two locations, by running
.\adb.exe push c:\temp\hosts /etc/hosts
.\adb.exe push c:\temp\hosts /system/etc/hosts
- Restart you device by running
.\adb.exe reboot
- After reboot, verify hosts file content by again running
.\adb.exe shell cat /etc/hosts
- You can now shutdown your emulator - In windows you can open the first termminal and click
Ctrl-C
Your new hosts file should now be active any time you run this emulator, as long as you do not completely reset it. You would then have to repeat the process.