diff --git a/setup/native-script.ps1 b/setup/native-script.ps1 index cb5f028724..5966d815cb 100644 --- a/setup/native-script.ps1 +++ b/setup/native-script.ps1 @@ -97,28 +97,21 @@ 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" } 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." diff --git a/setup/native-script.rb b/setup/native-script.rb index b70aa25d31..b5d9d8ff2c 100755 --- a/setup/native-script.rb +++ b/setup/native-script.rb @@ -97,8 +97,7 @@ def install_environment_variable(name, value) unless ENV["ANDROID_HOME"] require 'pathname' - # if android-sdk was installed through brew, there should be a symlink in /usr/local/opt/android-sdk pointing to the actual sdk - android_home = "/usr/local/opt/android-sdk" + android_home = "/usr/local/share/android-sdk" unless Pathname.new(android_home).exist? require 'mkmf' # if there's no such symlink then try to find the `android-sdk` directory through the `android` executable @@ -134,26 +133,18 @@ def install_environment_variable(name, value) execute("echo y | #{android_executable} \"tools\"", error_msg) execute("echo y | #{android_executable} \"build-tools;25.0.2\"", error_msg) execute("echo y | #{android_executable} \"platforms;android-25\"", error_msg) -execute("echo y | #{android_executable} \"platforms;android-24\"", error_msg) -execute("echo y | #{android_executable} \"platforms;android-23\"", error_msg) -execute("echo y | #{android_executable} \"platforms;android-22\"", error_msg) -execute("echo y | #{android_executable} \"platforms;android-21\"", error_msg) -execute("echo y | #{android_executable} \"platforms;android-19\"", error_msg) -execute("echo y | #{android_executable} \"platforms;android-18\"", error_msg) -execute("echo y | #{android_executable} \"platforms;android-17\"", error_msg) +execute("echo y | #{android_executable} \"extras;android;m2repository\"", error_msg) +execute("echo y | #{android_executable} \"extras;google;m2repository\"", error_msg) puts "Do you want to install Android emulator? (y/n)" if gets.chomp.downcase == "y" puts "Do you want to install HAXM (Hardware accelerated Android emulator)? (y/n)" if gets.chomp.downcase == "y" execute("echo y | #{android_executable} \"extras;intel;Hardware_Accelerated_Execution_Manager\"", error_msg) - haxm_silent_installer = File.join(ENV["ANDROID_HOME"], "extras", "intel", "Hardware_Accelerated_Execution_Manager", "silent_install.sh") execute("sudo #{haxm_silent_installer}", "There seem to be some problems with the Android configuration") - else end - execute("echo y | #{android_executable} \"system-images;android-25;google_apis;x86\"", error_msg) - execute("echo y | #{android_executable} \"system-images;android-24;default;x86\"", error_msg) + execute("echo y | #{android_executable} \"system-images;android-25;google_apis;x86\"", error_msg) end puts "The ANDROID_HOME and JAVA_HOME environment variables have been added to your .bash_profile/.zprofile"