@@ -97,8 +97,7 @@ def install_environment_variable(name, value)
97
97
98
98
unless ENV [ "ANDROID_HOME" ]
99
99
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"
102
101
unless Pathname . new ( android_home ) . exist?
103
102
require 'mkmf'
104
103
# if there's no such symlink then try to find the `android-sdk` directory through the `android` executable
@@ -129,32 +128,24 @@ def install_environment_variable(name, value)
129
128
# the android tool will introduce a --accept-license option in subsequent releases
130
129
error_msg = "There seem to be some problems with the Android configuration"
131
130
132
- android_executable = File . join ( ENV [ "ANDROID_HOME" ] , "tools" , "bin" , "sdkmanager" )
133
- execute ( "echo y | #{ android_executable } \" platform-tools\" " , error_msg )
134
- execute ( "echo y | #{ android_executable } \" tools\" " , error_msg )
135
- execute ( "echo y | #{ android_executable } \" build-tools;25.0.2\" " , error_msg )
136
- 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 )
131
+ sdk_manager = File . join ( ENV [ "ANDROID_HOME" ] , "tools" , "bin" , "sdkmanager" )
132
+ execute ( "echo y | #{ sdk_manager } \" platform-tools\" " , error_msg )
133
+ execute ( "echo y | #{ sdk_manager } \" tools\" " , error_msg )
134
+ execute ( "echo y | #{ sdk_manager } \" build-tools;25.0.2\" " , error_msg )
135
+ execute ( "echo y | #{ sdk_manager } \" platforms;android-23\" " , error_msg )
136
+ execute ( "echo y | #{ sdk_manager } \" extras;android;m2repository\" " , error_msg )
137
+ execute ( "echo y | #{ sdk_manager } \" extras;google;m2repository\" " , error_msg )
144
138
145
139
puts "Do you want to install Android emulator? (y/n)"
146
140
if gets . chomp . downcase == "y"
147
141
puts "Do you want to install HAXM (Hardware accelerated Android emulator)? (y/n)"
148
142
if gets . chomp . downcase == "y"
149
- execute ( "echo y | #{ android_executable } \" extras;intel;Hardware_Accelerated_Execution_Manager\" " , error_msg )
150
-
143
+ execute ( "echo y | #{ sdk_manager } \" extras;intel;Hardware_Accelerated_Execution_Manager\" " , error_msg )
151
144
haxm_silent_installer = File . join ( ENV [ "ANDROID_HOME" ] , "extras" , "intel" , "Hardware_Accelerated_Execution_Manager" , "silent_install.sh" )
152
145
execute ( "sudo #{ haxm_silent_installer } " , "There seem to be some problems with the Android configuration" )
153
- else
154
146
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 | #{ sdk_manager } \" system-images;android-23;default;x86\" " , error_msg )
157
148
end
158
149
159
150
puts "The ANDROID_HOME and JAVA_HOME environment variables have been added to your .bash_profile/.zprofile"
160
- puts "Restart the terminal or run `source ~/.bash_profile` to use them."
151
+ puts "Restart the terminal or run `source ~/.bash_profile` to use them."
0 commit comments