mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-11 01:57:00 +00:00
Bug 1924484 - Document how to create and use Android AVD r=tthibaud,geckoview-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D225511
This commit is contained in:
parent
907db54691
commit
0effe3eacb
@ -161,6 +161,76 @@ uncomment the option matching your test device. Usually, this means uncommenting
|
||||
**Note:** When using an emulator, the mozconfig target configuration will most likely need to match
|
||||
the architecture of your machine.
|
||||
|
||||
Custom AVD
|
||||
~~~~~~~~~~
|
||||
|
||||
There are several reasons creating a custom AVD can be required, like e.g. the
|
||||
default emulator setup might be too old for some tasks, and it might be
|
||||
required to run some newer versions of the APIs or others.
|
||||
|
||||
Assuming the following environment variables are already set (versions/OS may change):
|
||||
|
||||
.. code:: bash
|
||||
|
||||
JAVA_HOME=$HOME/.mozbuild/jdk/jdk-17.0.12+7
|
||||
ANDROID_HOME=$HOME/.mozbuild/android-sdk-linux
|
||||
ANDROID_AVD_HOME=$HOME/.mozbuild/android-device/avd
|
||||
PATH=$ANDROID_HOME/cmdline-tools/12.0/bin/:$PATH
|
||||
|
||||
You can identify usable packages already installed on your system via
|
||||
|
||||
.. code:: bash
|
||||
|
||||
sdkmanager --list
|
||||
|
||||
It will output list of available and installed packages. Packages of interest
|
||||
are ``system-images`` and follow the rule ``system-images;android-API;pkg;arch`` where
|
||||
|
||||
- ``API`` is the `Android API level <https://developer.android.com/tools/releases/platforms>`_
|
||||
- ``pkg`` is the set of package installed, e.g., ``default``, ``google_apis``, ``google_apis_playstore``
|
||||
- the last one being the emulator architecture and usually stick to ``x86_64``.
|
||||
|
||||
The system image package you will use needs to be installed, so if it is not
|
||||
already in the list above, please use (in this example it installs the package
|
||||
for Android 14 (API level 34), ``default`` package and ``x86_64`` arch).
|
||||
|
||||
.. code:: bash
|
||||
|
||||
sdkmanager "system-images;android-34;default;x86_64"
|
||||
|
||||
Then the AVD can be created with:
|
||||
|
||||
.. code:: bash
|
||||
|
||||
avdmanager create avd --name android14-x86_64 --package "system-images;android-34;default;x86_64"
|
||||
|
||||
The name passed in argument can be whatever you want and the package is one of
|
||||
the installed list. It is then required to modify entries within
|
||||
`android_device.py <https://searchfox.org/mozilla-central/rev/d56687458d4e6e8882c4b740e78413a0f0a69d59/testing/mozbase/mozrunner/mozrunner/devices/android_device.py#101-175>`_ to be able to make use of ``mach android-emulator``,
|
||||
changing the definition to match the name of the AVD created above. Example below:
|
||||
|
||||
.. code:: diff
|
||||
|
||||
diff --git a/testing/mozbase/mozrunner/mozrunner/devices/android_device.py b/testing/mozbase/mozrunner/mozrunner/devices/android_device.py
|
||||
index 4f883261d45c1..07f91c1ab800e 100644
|
||||
--- a/testing/mozbase/mozrunner/mozrunner/devices/android_device.py
|
||||
+++ b/testing/mozbase/mozrunner/mozrunner/devices/android_device.py
|
||||
@@ -151,7 +151,7 @@ AVD_DICT = {
|
||||
),
|
||||
"x86_64": AvdInfo(
|
||||
"Android x86_64",
|
||||
- "mozemulator-x86_64",
|
||||
+ "android14-x86_64",
|
||||
[
|
||||
"-skip-adb-auth",
|
||||
"-verbose",
|
||||
|
||||
Once the avd is created, it can be customized by changing the ``config.ini``
|
||||
file (located under ``$ANDROID_AVD_HOME/<avd-name>.avd/``, e.g.,
|
||||
``$HOME/.mozbuild/android-device/avd/android14-x86_64/config.ini`` in the above
|
||||
example). It is recommended to enable physical keyboard by changing the value
|
||||
``hw.keyboard`` to ``yes`` (otherwise only virtual keyboard input will work).
|
||||
|
||||
Custom mozconfig with Android Studio
|
||||
------------------------------------
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user