Skip to content

Commit 445b463

Browse files
authored
Fix setup script for Windows #3048 (#3049)
* Change android command line tool * Fix the default path to android tools to the actual installation point * Replace x86 image with ARM, when HAXM is not available * Install x86 with HAMX and otherwise arm image
1 parent 1f46ca1 commit 445b463

File tree

1 file changed

+14
-18
lines changed

1 file changed

+14
-18
lines changed

setup/native-script.ps1

+14-18
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ if (!$env:ANDROID_HOME) {
8181
$androidHome = Resolve-Path $androidHomeJoinedPath | Select-Object -ExpandProperty Path
8282
}
8383
else {
84-
$androidHome = "$env:localappdata\Android\android-sdk"
84+
$androidHome = "${Env:SystemDrive}\Android\android-sdk"
8585
}
8686

8787
$env:ANDROID_HOME = $androidHome;
@@ -97,29 +97,25 @@ if (!$env:JAVA_HOME) {
9797

9898
# setup android sdk
9999
# following commands are separated in case of having to answer to license agreements
100-
# the android tool will introduce a --accept-license option in subsequent releases
101-
$androidExecutable = [io.path]::combine($env:ANDROID_HOME, "tools", "android")
102-
echo y | cmd /c "$androidExecutable" update sdk --filter "platform-tools" --all --no-ui
103-
echo y | cmd /c "$androidExecutable" update sdk --filter "tools" --all --no-ui
104-
echo y | cmd /c "$androidExecutable" update sdk --filter "android-23" --all --no-ui
105-
echo y | cmd /c "$androidExecutable" update sdk --filter "build-tools-25.0.2" --all --no-ui
106-
echo y | cmd /c "$androidExecutable" update sdk --filter "build-tools-23.0.3" --all --no-ui
107-
echo y | cmd /c "$androidExecutable" update sdk --filter "extra-android-m2repository" --all --no-ui
100+
$androidExecutable = [io.path]::combine($env:ANDROID_HOME, "tools", "bin", "sdkmanager")
101+
echo y | cmd /c "$androidExecutable" "platform-tools"
102+
echo y | cmd /c "$androidExecutable" "tools"
103+
echo y | cmd /c "$androidExecutable" "build-tools;25.0.2"
104+
echo y | cmd /c "$androidExecutable" "platforms;android-23"
105+
echo y | cmd /c "$androidExecutable" "extras;android;m2repository"
106+
echo y | cmd /c "$androidExecutable" "extras;google;m2repository"
108107

109108
if ((Read-Host "Do you want to install Android emulator?") -eq 'y') {
110109
if ((Read-Host "Do you want to install HAXM (Hardware accelerated Android emulator)?") -eq 'y') {
111-
echo y | cmd /c "$androidExecutable" update sdk --filter extra-intel-Hardware_Accelerated_Execution_Manager --all --no-ui
112-
110+
echo y | cmd /c "$androidExecutable" "extras;intel;Hardware_Accelerated_Execution_Manager"
113111
$haxmSilentInstaller = [io.path]::combine($env:ANDROID_HOME, "extras", "intel", "Hardware_Accelerated_Execution_Manager", "silent_install.bat")
114112
cmd /c "$haxmSilentInstaller"
115-
116-
echo y | cmd /c "$androidExecutable" update sdk --filter sys-img-x86-android-23 --all --no-ui
117-
echo no | cmd /c "$androidExecutable" create avd -n Emulator-Api23-Default -t android-23 --abi default/x86 -c 12M -f
118-
} else {
119-
echo y | cmd /c "$androidExecutable" update sdk --filter sys-img-armeabi-v7a-android-23 --all --no-ui
120-
echo no | cmd /c "$androidExecutable" create avd -n Emulator-Api23-Default -t android-23 --abi default/armeabi-v7a -c 12M -f
113+
echo y | cmd /c "$androidExecutable" "system-images;android-25;google_apis;x86"
114+
}
115+
else {
116+
echo y | cmd /c "$androidExecutable" "system-images;android-25;google_apis;armeabi-v7a"
121117
}
122118
}
123119

124120
Write-Host -ForegroundColor Green "This script has modified your environment. You need to log off and log back on for the changes to take effect."
125-
Pause
121+
Pause

0 commit comments

Comments
 (0)