From ebc2dfed9179f43fc1baec13de4cd096f5129b68 Mon Sep 17 00:00:00 2001 From: Emil Tabakov Date: Wed, 12 Apr 2017 13:31:08 +0300 Subject: [PATCH 1/5] Fix android sdk commands to use sdkmanager --- setup/native-script.rb | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) mode change 100644 => 100755 setup/native-script.rb diff --git a/setup/native-script.rb b/setup/native-script.rb old mode 100644 new mode 100755 index 81dc86b610..9b44dfc52e --- a/setup/native-script.rb +++ b/setup/native-script.rb @@ -129,29 +129,29 @@ def install_environment_variable(name, value) # the android tool will introduce a --accept-license option in subsequent releases error_msg = "There seem to be some problems with the Android configuration" -android_executable = File.join(ENV["ANDROID_HOME"], "tools", "android") -execute("echo y | #{android_executable} update sdk --filter platform-tools --all --no-ui", error_msg) -execute("echo y | #{android_executable} update sdk --filter tools --all --no-ui", error_msg) -execute("echo y | #{android_executable} update sdk --filter android-23 --all --no-ui", error_msg) -execute("echo y | #{android_executable} update sdk --filter build-tools-25.0.2 --all --no-ui", error_msg) -execute("echo y | #{android_executable} update sdk --filter build-tools-23.0.3 --all --no-ui", error_msg) -execute("echo y | #{android_executable} update sdk --filter extra-android-m2repository --all --no-ui", error_msg) -execute("echo y | #{android_executable} update sdk --filter extra-google-m2repository --all --no-ui", error_msg) +android_executable = File.join(ENV["ANDROID_HOME"], "tools", "bin", "sdkmanager") +execute("echo y | #{android_executable} platform-tools --all --no-ui", error_msg) +execute("echo y | #{android_executable} tools --all --no-ui", error_msg) +execute("echo y | #{android_executable} android-23 --all --no-ui", error_msg) +execute("echo y | #{android_executable} build-tools-25.0.2 --all --no-ui", error_msg) +execute("echo y | #{android_executable} build-tools-23.0.3 --all --no-ui", error_msg) +execute("echo y | #{android_executable} extra-android-m2repository --all --no-ui", error_msg) +execute("echo y | #{android_executable} extra-google-m2repository --all --no-ui", 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} update sdk --filter extra-intel-Hardware_Accelerated_Execution_Manager --all --no-ui", error_msg) + execute("echo y | #{android_executable} extra-intel-Hardware_Accelerated_Execution_Manager --all --no-ui", error_msg) haxm_silent_installer = File.join(ENV["ANDROID_HOME"], "extras", "intel", "Hardware_Accelerated_Execution_Manager", "silent_install.sh") execute("#{haxm_silent_installer}", "There seem to be some problems with the Android configuration") - execute("echo y | #{android_executable} update sdk --filter sys-img-x86-android-23 --all --no-ui", error_msg) - execute("echo no | #{android_executable} create avd -n Emulator-Api23-Default -t android-23 --abi default/x86 -c 12M -f", error_msg) + execute("echo y | #{android_executable} sys-img-x86-android-23 --all --no-ui", error_msg) + execute("echo no | android avd -n Emulator-Api23-Default -t android-23 --abi default/x86 -c 12M -f", error_msg) else - execute("echo y | #{android_executable} update sdk --filter sys-img-armeabi-v7a-android-23 --all --no-ui", error_msg) - execute("echo no | #{android_executable} create avd -n Emulator-Api23-Default -t android-23 --abi default/armeabi-v7a -c 12M -f", error_msg) + execute("echo y | #{android_executable} sys-img-armeabi-v7a-android-23 --all --no-ui", error_msg) + execute("echo no | android avd -n Emulator-Api23-Default -t android-23 --abi default/armeabi-v7a -c 12M -f", error_msg) end end From 75c95157bf40de69967d363fbd255577a453c882 Mon Sep 17 00:00:00 2001 From: Emil Tabakov Date: Wed, 12 Apr 2017 13:44:59 +0300 Subject: [PATCH 2/5] Replace brew install with brew cask --- setup/native-script.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup/native-script.rb b/setup/native-script.rb index 9b44dfc52e..081389cb67 100755 --- a/setup/native-script.rb +++ b/setup/native-script.rb @@ -93,7 +93,7 @@ def install_environment_variable(name, value) end install("Java SE Development Kit", "Installing the Java SE Development Kit... This might take some time, please, be patient. (You will be prompted for your password)", 'brew cask install java', false, false) -install("Android SDK", "Installing Android SDK", 'brew install android-sdk', false) +install("Android SDK", "Installing Android SDK", 'brew cask install android-sdk', false) unless ENV["ANDROID_HOME"] require 'pathname' From 27cffe4d33fc3fbdcf4aff78824136f675aca1c6 Mon Sep 17 00:00:00 2001 From: Emil Tabakov Date: Thu, 13 Apr 2017 11:46:24 +0300 Subject: [PATCH 3/5] Fix installation for haxm --- setup/native-script.rb | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/setup/native-script.rb b/setup/native-script.rb index 081389cb67..41b60f76e9 100755 --- a/setup/native-script.rb +++ b/setup/native-script.rb @@ -130,29 +130,30 @@ def install_environment_variable(name, value) error_msg = "There seem to be some problems with the Android configuration" android_executable = File.join(ENV["ANDROID_HOME"], "tools", "bin", "sdkmanager") -execute("echo y | #{android_executable} platform-tools --all --no-ui", error_msg) -execute("echo y | #{android_executable} tools --all --no-ui", error_msg) -execute("echo y | #{android_executable} android-23 --all --no-ui", error_msg) -execute("echo y | #{android_executable} build-tools-25.0.2 --all --no-ui", error_msg) -execute("echo y | #{android_executable} build-tools-23.0.3 --all --no-ui", error_msg) -execute("echo y | #{android_executable} extra-android-m2repository --all --no-ui", error_msg) -execute("echo y | #{android_executable} extra-google-m2repository --all --no-ui", error_msg) +execute("echo y | #{android_executable} \"platform-tools\"", error_msg) +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) 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} extra-intel-Hardware_Accelerated_Execution_Manager --all --no-ui", error_msg) - + 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("#{haxm_silent_installer}", "There seem to be some problems with the Android configuration") - - execute("echo y | #{android_executable} sys-img-x86-android-23 --all --no-ui", error_msg) - execute("echo no | android avd -n Emulator-Api23-Default -t android-23 --abi default/x86 -c 12M -f", error_msg) - else - execute("echo y | #{android_executable} sys-img-armeabi-v7a-android-23 --all --no-ui", error_msg) - execute("echo no | android avd -n Emulator-Api23-Default -t android-23 --abi default/armeabi-v7a -c 12M -f", error_msg) + 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) end puts "The ANDROID_HOME and JAVA_HOME environment variables have been added to your .bash_profile/.zprofile" From 904de97651221b8c46750d2a0715d7edc6c17089 Mon Sep 17 00:00:00 2001 From: Emil Tabakov Date: Tue, 18 Apr 2017 11:51:30 +0300 Subject: [PATCH 4/5] Change brew formulae repository before installing android sdk --- setup/native-script.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup/native-script.rb b/setup/native-script.rb index 41b60f76e9..4fbc398fc0 100755 --- a/setup/native-script.rb +++ b/setup/native-script.rb @@ -93,7 +93,7 @@ def install_environment_variable(name, value) end install("Java SE Development Kit", "Installing the Java SE Development Kit... This might take some time, please, be patient. (You will be prompted for your password)", 'brew cask install java', false, false) -install("Android SDK", "Installing Android SDK", 'brew cask install android-sdk', false) +install("Android SDK", "Installing Android SDK", 'brew tap caskroom/cask; brew cask install android-sdk', false) unless ENV["ANDROID_HOME"] require 'pathname' From 59c10dee17326e47161d5aa60f7542f19c97addb Mon Sep 17 00:00:00 2001 From: Emil Tabakov Date: Wed, 19 Apr 2017 11:34:23 +0300 Subject: [PATCH 5/5] Fix setting the ENV variable missing cast --- setup/native-script.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup/native-script.rb b/setup/native-script.rb index 4fbc398fc0..b70aa25d31 100755 --- a/setup/native-script.rb +++ b/setup/native-script.rb @@ -76,7 +76,7 @@ def install(program_name, message, script, run_as_root = false, show_all_option end def install_environment_variable(name, value) - ENV[name] = value + ENV[name] = value.to_s execute("echo \"export #{name}=#{value}\" >> ~/.bash_profile", "Unable to set #{name}")