Skip to content

Fix setup script for Windows #3048 #3049

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 17, 2017
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 11 additions & 18 deletions setup/native-script.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ if (!$env:ANDROID_HOME) {
$androidHome = Resolve-Path $androidHomeJoinedPath | Select-Object -ExpandProperty Path
}
else {
$androidHome = "$env:localappdata\Android\android-sdk"
$androidHome = "${Env:SystemDrive}\Android\android-sdk"
}

$env:ANDROID_HOME = $androidHome;
Expand All @@ -97,29 +97,22 @@ if (!$env:JAVA_HOME) {

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

if ((Read-Host "Do you want to install Android emulator?") -eq 'y') {
if ((Read-Host "Do you want to install HAXM (Hardware accelerated Android emulator)?") -eq 'y') {
echo y | cmd /c "$androidExecutable" update sdk --filter extra-intel-Hardware_Accelerated_Execution_Manager --all --no-ui

echo y | cmd /c "$androidExecutable" "extras;intel;Hardware_Accelerated_Execution_Manager"
$haxmSilentInstaller = [io.path]::combine($env:ANDROID_HOME, "extras", "intel", "Hardware_Accelerated_Execution_Manager", "silent_install.bat")
cmd /c "$haxmSilentInstaller"

echo y | cmd /c "$androidExecutable" update sdk --filter sys-img-x86-android-23 --all --no-ui
echo no | cmd /c "$androidExecutable" create avd -n Emulator-Api23-Default -t android-23 --abi default/x86 -c 12M -f
} else {
echo y | cmd /c "$androidExecutable" update sdk --filter sys-img-armeabi-v7a-android-23 --all --no-ui
echo no | cmd /c "$androidExecutable" create avd -n Emulator-Api23-Default -t android-23 --abi default/armeabi-v7a -c 12M -f
}
echo y | cmd /c "$androidExecutable" "system-images;android-25;google_apis;x86"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will try to install x86 emulator in case the answer of "Do you want to install HAXM (Hardware accelerated Android emulator)?" is no, will this work?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replaced with ARM image. I will change the emulator in the macOS script as well, when I get to it.

}

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."
Pause
Pause