Skip to content

Commit f93232d

Browse files
vchimevvchimev
vchimev
authored and
vchimev
committed
Update Android SDK Packages in setup scripts
1 parent 9c6bf82 commit f93232d

File tree

2 files changed

+13
-29
lines changed

2 files changed

+13
-29
lines changed

setup/native-script.ps1

+9-16
Original file line numberDiff line numberDiff line change
@@ -97,28 +97,21 @@ 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
121113
}
114+
echo y | cmd /c "$androidExecutable" "system-images;android-25;google_apis;x86"
122115
}
123116

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

setup/native-script.rb

+4-13
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,7 @@ def install_environment_variable(name, value)
9797

9898
unless ENV["ANDROID_HOME"]
9999
require 'pathname'
100-
# if android-sdk was installed through brew, there should be a symlink in /usr/local/opt/android-sdk pointing to the actual sdk
101-
android_home = "/usr/local/opt/android-sdk"
100+
android_home = "/usr/local/share/android-sdk"
102101
unless Pathname.new(android_home).exist?
103102
require 'mkmf'
104103
# 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)
134133
execute("echo y | #{android_executable} \"tools\"", error_msg)
135134
execute("echo y | #{android_executable} \"build-tools;25.0.2\"", error_msg)
136135
execute("echo y | #{android_executable} \"platforms;android-25\"", error_msg)
137-
execute("echo y | #{android_executable} \"platforms;android-24\"", error_msg)
138-
execute("echo y | #{android_executable} \"platforms;android-23\"", error_msg)
139-
execute("echo y | #{android_executable} \"platforms;android-22\"", error_msg)
140-
execute("echo y | #{android_executable} \"platforms;android-21\"", error_msg)
141-
execute("echo y | #{android_executable} \"platforms;android-19\"", error_msg)
142-
execute("echo y | #{android_executable} \"platforms;android-18\"", error_msg)
143-
execute("echo y | #{android_executable} \"platforms;android-17\"", error_msg)
136+
execute("echo y | #{android_executable} \"extras;android;m2repository\"", error_msg)
137+
execute("echo y | #{android_executable} \"extras;google;m2repository\"", error_msg)
144138

145139
puts "Do you want to install Android emulator? (y/n)"
146140
if gets.chomp.downcase == "y"
147141
puts "Do you want to install HAXM (Hardware accelerated Android emulator)? (y/n)"
148142
if gets.chomp.downcase == "y"
149143
execute("echo y | #{android_executable} \"extras;intel;Hardware_Accelerated_Execution_Manager\"", error_msg)
150-
151144
haxm_silent_installer = File.join(ENV["ANDROID_HOME"], "extras", "intel", "Hardware_Accelerated_Execution_Manager", "silent_install.sh")
152145
execute("sudo #{haxm_silent_installer}", "There seem to be some problems with the Android configuration")
153-
else
154146
end
155-
execute("echo y | #{android_executable} \"system-images;android-25;google_apis;x86\"", error_msg)
156-
execute("echo y | #{android_executable} \"system-images;android-24;default;x86\"", error_msg)
147+
execute("echo y | #{android_executable} \"system-images;android-25;google_apis;x86\"", error_msg)
157148
end
158149

159150
puts "The ANDROID_HOME and JAVA_HOME environment variables have been added to your .bash_profile/.zprofile"

0 commit comments

Comments
 (0)