Skip to content

Commit

Permalink
Support downloading Android emulator system image on Linux aarch64
Browse files Browse the repository at this point in the history
  • Loading branch information
rmartin16 committed Nov 1, 2023
1 parent ccd1c7c commit a4dc56b
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 14 deletions.
1 change: 1 addition & 0 deletions changes/1519.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
It is now possible to create an Android emulator AVD on Linux for arm64.
28 changes: 19 additions & 9 deletions src/briefcase/integrations/android_sdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,15 +142,25 @@ def env(self) -> dict[str, str]:
@property
def emulator_abi(self) -> str:
"""The ABI to use for the Android emulator."""
if self.tools.host_arch == "arm64" and self.tools.host_os == "Darwin":
return "arm64-v8a"
if self.tools.host_arch in ("x86_64", "AMD64"):
return "x86_64"

raise BriefcaseCommandError(
"The Android emulator does not currently support "
f"{self.tools.host_os} {self.tools.host_arch} hardware."
)
try:
return {
"Linux": {
"x86_64": "x86_64",
"aarch64": "arm64-v8a",
},
"Darwin": {
"x86_64": "x86_64",
"arm64": "arm64-v8a",
},
"Windows": {
"AMD64": "x86_64",
},
}[self.tools.host_os][self.tools.host_arch]
except KeyError:
raise BriefcaseCommandError(
"The Android emulator does not currently support "
f"{self.tools.host_os} {self.tools.host_arch} hardware."
)

@property
def DEFAULT_DEVICE_TYPE(self) -> str:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ def android_sdk(android_sdk) -> AndroidSDK:
[
("Darwin", "x86_64", "x86_64"),
("Darwin", "arm64", "arm64-v8a"),
("Windows", "x86_64", "x86_64"),
("Windows", "AMD64", "x86_64"),
("Linux", "x86_64", "x86_64"),
("Linux", "aarch64", "arm64-v8a"),
],
)
def test_create_emulator(
Expand Down Expand Up @@ -117,8 +118,9 @@ def test_create_emulator(
[
("Darwin", "x86_64", "x86_64"),
("Darwin", "arm64", "arm64-v8a"),
("Windows", "x86_64", "x86_64"),
("Windows", "AMD64", "x86_64"),
("Linux", "x86_64", "x86_64"),
("Linux", "aarch64", "arm64-v8a"),
],
)
def test_create_emulator_with_defaults(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ def android_sdk(android_sdk) -> AndroidSDK:
[
("Darwin", "x86_64", "x86_64"),
("Darwin", "arm64", "arm64-v8a"),
("Windows", "x86_64", "x86_64"),
("Windows", "AMD64", "x86_64"),
("Linux", "x86_64", "x86_64"),
("Linux", "aarch64", "arm64-v8a"),
],
)
def test_create_emulator(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ def test_managed_install(mock_tools, android_sdk):
[
("Darwin", "x86_64", "x86_64"),
("Darwin", "arm64", "arm64-v8a"),
("Windows", "x86_64", "x86_64"),
("Windows", "AMD64", "x86_64"),
("Linux", "x86_64", "x86_64"),
("Linux", "aarch64", "arm64-v8a"),
],
)
def test_emulator_abi(mock_tools, android_sdk, host_os, host_arch, emulator_abi):
Expand Down
1 change: 1 addition & 0 deletions tests/integrations/android_sdk/AndroidSDK/test_verify.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ def test_unsupported_arch(mock_tools):
("Darwin", "arm64"),
("Darwin", "x86_64"),
("Linux", "x86_64"),
("Linux", "aarch64"),
("Windows", "AMD64"),
],
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"host_os, host_arch",
[
("Windows", "arm64"),
("Linux", "arm64"),
("Linux", "armv7l"),
],
)
def test_unsupported_abi(mock_tools, android_sdk, host_os, host_arch):
Expand Down

0 comments on commit a4dc56b

Please sign in to comment.