Skip to content
This repository was archived by the owner on May 15, 2024. It is now read-only.

Commit df1437c

Browse files
Android setup Script (#1086)
* Add Android setup script Installs everything you need for development :) * Update README.md * Update README.md
1 parent d26357f commit df1437c

File tree

2 files changed

+55
-0
lines changed

2 files changed

+55
-0
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ A minimum version of Visual Studio 2019 16.3 or Visual Studio for Mac 2019 8.3 a
6060
* Android 10.0, 9.0, 8.1, 8.0, 7.1, 7.0, & 6.0 SDK Installed
6161
* UWP 10.0.16299 SDK Installed
6262

63+
Your can run the included `android-setup.ps1` script in **Administrator Mode** and it will automatically setup your Android environment.
64+
6365
## FAQ
6466

6567
Here are some frequently asked questions about Xamarin.Essentials, but be sure to read our full [FAQ on our Wiki](https://github.com/xamarin/Essentials/wiki#feature-faq).

android-setup.ps1

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
$androidSdkHome = $ENV:ANDROID_HOME
2+
3+
if ([string]::IsNullOrWhiteSpace($androidSdkHome))
4+
{
5+
if ($ENV:OS -eq "Windows_NT")
6+
{
7+
$androidSdkHome = "C:\Program Files (x86)\Android\android-sdk\"
8+
}
9+
else
10+
{
11+
$androidSdkHome = Resolve-Path "~/Library/Developer/Xamarin/android-sdk-macosx"
12+
}
13+
14+
Write-Host "Couldn't locate ANDROID_HOME, using: $androidSdkHome"
15+
}
16+
17+
Write-Host "Using Android SDK Home: $androidSdkHome"
18+
19+
Write-Host "Installing Global dotnet android tool..."
20+
dotnet tool install --global --add-source https://www.myget.org/F/xam-dotnet-tools/api/v3/index.json AndroidSdk.Tool
21+
22+
Write-Host "Installing and/or Updating Android SDK..."
23+
Write-Host "This may take awhile..."
24+
android --home="$androidSdkHome" sdk download
25+
26+
Write-Host "Installing API 23..."
27+
android --home="$androidSdkHome" sdk --install="platforms;android-23"
28+
29+
Write-Host "Installing API 24..."
30+
android --home="$androidSdkHome" sdk --install="platforms;android-24"
31+
32+
Write-Host "Installing API 25..."
33+
android --home="$androidSdkHome" sdk --install="platforms;android-25"
34+
35+
Write-Host "Installing API 26..."
36+
android --home="$androidSdkHome" sdk --install="platforms;android-26"
37+
38+
Write-Host "Installing API 27..."
39+
android --home="$androidSdkHome" sdk --install="platforms;android-27"
40+
41+
Write-Host "Installing API 28..."
42+
android --home="$androidSdkHome" sdk --install="platforms;android-28"
43+
44+
Write-Host "Installing API 29..."
45+
android --home="$androidSdkHome" sdk --install="platforms;android-29"
46+
47+
Write-Host "Installing API 29 Emulator Image (x86_64 - google_apis)..."
48+
android --home="$androidSdkHome" sdk --install="system-images;android-29;google_apis;x86_64"
49+
50+
Write-Host "Creating XamarinEmulator virtual device..."
51+
android --home="$androidSdkHome" emulator create XamarinEmulator "system-images;android-29;google_apis;x86_64" --device=Pixel --force
52+
53+
Write-Host "Done!"

0 commit comments

Comments
 (0)