|
1 | 1 | using System; |
2 | 2 | using System.Collections.Generic; |
3 | 3 | using System.IO; |
| 4 | +using System.Runtime.InteropServices; |
4 | 5 |
|
5 | 6 | namespace Xamarin.Android.Prepare |
6 | 7 | { |
@@ -30,10 +31,14 @@ public AndroidToolchain () |
30 | 31 | string XABuildTools30PackagePrefix = Context.Instance.Properties [KnownProperties.XABuildTools30PackagePrefix] ?? String.Empty; |
31 | 32 | string XAPlatformToolsVersion = GetRequiredProperty (KnownProperties.XAPlatformToolsVersion); |
32 | 33 | string XAPlatformToolsPackagePrefix = Context.Instance.Properties [KnownProperties.XAPlatformToolsPackagePrefix] ?? String.Empty; |
| 34 | + bool isArm64Apple = Context.Instance.OS.Flavor == "macOS" && RuntimeInformation.OSArchitecture == Architecture.Arm64; |
| 35 | + string emulatorArch = isArm64Apple ? "aarch64" : "x64"; |
| 36 | + string systemImageArch = isArm64Apple ? "arm64-v8a" : "x86_64"; |
33 | 37 |
|
34 | 38 | // Upstream manifests with version information: |
35 | 39 | // |
36 | 40 | // https://dl-ssl.google.com/android/repository/repository2-1.xml |
| 41 | + // https://dl-ssl.google.com/android/repository/repository2-3.xml |
37 | 42 | // * platform APIs |
38 | 43 | // * build-tools |
39 | 44 | // * command-line tools |
@@ -87,10 +92,10 @@ public AndroidToolchain () |
87 | 92 | dependencyType: AndroidToolchainComponentType.BuildDependency, |
88 | 93 | buildToolVersion: "47.0.0" |
89 | 94 | ), |
90 | | - new AndroidToolchainComponent ($"x86_64-29_r07-{osTag}", |
91 | | - destDir: Path.Combine ("system-images", "android-29", "default", "x86_64"), |
| 95 | + new AndroidToolchainComponent (isArm64Apple ? $"{systemImageArch}-29_r08" : $"{systemImageArch}-29_r08-{osTag}", |
| 96 | + destDir: Path.Combine ("system-images", "android-29", "default", systemImageArch), |
92 | 97 | relativeUrl: new Uri ("sys-img/android/", UriKind.Relative), |
93 | | - pkgRevision: "7", |
| 98 | + pkgRevision: "8", |
94 | 99 | dependencyType: AndroidToolchainComponentType.EmulatorDependency |
95 | 100 | ), |
96 | 101 | new AndroidToolchainComponent ($"android-ndk-r{AndroidNdkVersion}-{osTag}", |
@@ -123,7 +128,7 @@ public AndroidToolchain () |
123 | 128 | buildToolName: "android-sdk-platform-tools", |
124 | 129 | buildToolVersion: XAPlatformToolsVersion |
125 | 130 | ), |
126 | | - new AndroidToolchainComponent ($"emulator-{osTag}_x64-{EmulatorVersion}", |
| 131 | + new AndroidToolchainComponent ($"emulator-{osTag}_{emulatorArch}-{EmulatorVersion}", |
127 | 132 | destDir: "emulator", |
128 | 133 | pkgRevision: EmulatorPkgRevision, |
129 | 134 | dependencyType: AndroidToolchainComponentType.EmulatorDependency |
|
0 commit comments