Jump to content

Recommended Posts

Posted

I'm looking to deploy Android Studio to around 60 desktops. It doesn't appear to be as straight forward as I was hoping for and wondered if anyone else had cracked it. I have looked on their website and there are numerous downloads available, a 'bundle' of the IDE and SDK or you can download them individually.

 

https://developer.android.com/studio/index.html

 

Firstly you need the JDK installed as a prerequisite before you do anything.

 

If you run the bundle with a /S parameter it does install, however the Android SDK gets installed to the appdata of the user who is installing. Not ideal when it's for a multi user environment on each computer.

 

I downloaded the IDE and SDK individually, I can get the IDE to install silently (Again, with the /S parameter) which is fine (tick that one off the list). The Android SDK is a little more difficult, I can run the file manually and follow the wizard and say 'install for all users' which dumps it into the C:\Program Files but I can't seem to work out how to do this silently. Once I have installed it manually and launch the program it then wants to know where the SDK belongs, I can't have it asking the students that it will cause havoc, and besides we don't let them view the C:\ drive to point it to where it belongs even if we told them. I had read that it requires a system variable creating called 'Android_Home' then pointing to the location, but how can I script that?

 

Any help would be much appreciated!

Posted

Ok, I've managed to get somewhere with this.

 

I can install the IDE with a /S

I can install the SDK with a /S /Allusers which appears to drop it into C:\Program Files\Android\android-sdk

I can set the Android_Home system variable in the registry here: HKLM\System\CurrentControlSet\Control\Session Manager\Environment

 

The final job was to update the Android Components in the SDK Manager. I can browse to C:\Program Files\Android\android-sdk\tools and run the following 'android list sdk --all' to get a list of components and then pick my packages. I then run 'android update sdk --no-ui --all --filter 1,3,4' (1,3,4 being the package IDs) but the only stumbling block to finishing this off is accepting the license, it waits for you to press 'y'. Any ideas how to automate this?

Posted

If you can't find a completely silent install with the command line switches, you could always pipe a "Y" to the command, ie;

 

echo y | android update sdk --etc

 

I've used that once or twice on troublesome install scripts.

  • Thanks 1
Posted
@DaveAshworth thanks for that little tip. It works for every package apart from the SDK Tools where it says "Failed to rename directory C:\android-sdk\tools to C:\android-sdk\temp\ToolPackage.old01.". Though if I use it without the echo command and press y it works fine. Very odd. Though, it's not a necessity it's just and update it's after - all the other packages are straight out installs.
Posted

I've managed to crack this. It's took a bit of experimenting but it's finally there, it may not necessarily be the way others would do it but I'll detail it below just in case anyone needs a starter on it.

 

To install Android Studio there is a prerequisite of having Java Development Kit installed.

 

jdk-7u79-windows-x64.exe /s

 

I then downloaded the IDE and Android SDK seperately, there are installers that bundle them together but the SDK ends up in your local appdata which isn't ideal for multi user computers.

 

IDE Install

 

android-studio-ide-143.2915827-windows.exe /S

 

Android SDK install which drops it into C:\Program Files (x86)\android\android-sdk

 

installer_r24.4.1-windows.exe /S /AllUsers

 

Registry edit to add a system variable to point to the Android SDK location. In my experience if I didn't add this it asks each user on logon where it is. Certainly in our school student's cannot see the C:\ drive and if I can do as much as possible without their input the better off we are!

 

regedit /s SystemVariable.reg

 

Contents of registry file

 

Windows Registry Editor Version 5.00

 

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment]

"ANDROID_HOME"="C:\\Program Files (x86)\\Android\\android-sdk"

Installing the Android SDK Packages involves browsing to the C:\Program Files (x86)\Android\android-sdk\tools and utilising the android.bat which launches the SDK Manager. I have chosen to do this without the UI so I can deploy it out to all the machines that require it without user input. As mentioned in posts above, I had a slight problem getting around the prompt to accept the license but @DaveAshworth provided a solution there.

 

echo y | android update sdk --no-ui --all --filter platform-tools,build-tools-24.0.1,android-22,android-23,doc-23,sys-img-armeabi-v7a-android-tv-23,sys-img-x86-android-tv-23,sys-img-armeabi-v7a-android-wear-23,sys-img-x86-android-wear-23,sys-img-armeabi-v7a-android-23,sys-img-x86_64-android-23,sys-img-x86-android-23,sys-img-armeabi-v7a-google_apis-23,sys-img-x86_64-google_apis-23,sys-img-x86-google_apis-23,sys-img-armeabi-v7a-android-tv-22,sys-img-x86-android-tv-22,sys-img-armeabi-v7a-android-wear-22,sys-img-x86-android-wear-22,sys-img-armeabi-v7a-android-22,sys-img-x86_64-android-22,sys-img-x86-android-22,sys-img-armeabi-v7a-google_apis-22,sys-img-x86_64-google_apis-22,sys-img-x86-google_apis-22,addon-google_apis-google-23,addon-google_apis-google-22,source-23,source-22,extra-google-m2repository,extra-google-usb_driver

 

You can obtain a list of all the packages with their names and ID by running 'Android list sdk --all --extended'. I would recommended using package names over ID because as and when new updates come out the IDs will change.

 

I did make a few edits to ideas.properties so point the projects folder to the user's home area rather than a local path too.

  • Thanks 2
Posted

I'm trying to do this for our high school's computer science lab, but I've fallen at the first hurdle. When I run the Android Studio IDE installer manually while logged in as myself, it silently installs fine. (Though it does flash up a "Verifying installer" window briefly.) When I try to install it using Altiris as either SYSTEM or an admin user on the machine that's not logged into the GUI, it hangs and never completes.

 

I'm installing 'android-studio-ide-143.2915827-windows.exe'

 

Has anyone else seen this problem?

Posted

Have you got UAC enabled on your client machine? It could be sat there waiting for user interaction. You have the right GPOs set for 'behaviour of the elevation prompt' and 'admin approval mode'?

 

I used PDQ Deploy to send out software, I found on the Android IDE installer that it kept falling with an error code of 1223. Turns out that it was actually installing it but PDQ didn't have 1223 as a success code. Once I added that in it all reported fine.

Posted

So the first problem was a rookie mistake on my part - NSIS installers need capitalized switches!

Then I ran into the code 1223 problem, and the IDE appeared to install fine so I just told Altiris to consider 1223 a success.

 

So I installed the SDK using

/S /AllUsers

and installed the registry key, but when I run the

android update sdk

tool, it seems to want to re-download all of that from Google, which would mean it would be doing it for every machine. This seems to defeat the purpose of deploying the SDK in the first place, no?

Posted

From what I've seen when you install the SDK it only downloads the SDK Tools and Manager. What the above command is actually doing is downloading the tools for the platform that you're wanting to use. I was asked to install Android 5.1 and 6 versions and accompanying packages that are listed in the SDK Manager. You're right, it will do it for every machine, but then I want those packages on every machine so they are consistent.

 

The only problem I faced was trying to get the actual SDK Tools to upgrade. It seemed to bomb out and wipe the tools directory.

  • 2 months later...
Posted

Hi there,

 

We've now gone down the route of using PDQDeploy to install this, however we still need to set proxy settings in the SDK somehow to be able to allow the download of the latest components. Does anyone know the command line string to set the proxy for the steps suggested by Liam86.

 

Thanks

Nick

Posted

Hi there,

 

Also, in addition does anyone know what the "minimum" SDK components that would be required for GCSE/A Level Computing. I ran Liam86's full list and it downloaded over 19.2Gb before I killed it. We have 128Gb SSD's in the computer suite PC's so there is no way we can push this amount to them for just one package :-/

 

Nick

Posted
Hi there,

 

We've now gone down the route of using PDQDeploy to install this, however we still need to set proxy settings in the SDK somehow to be able to allow the download of the latest components. Does anyone know the command line string to set the proxy for the steps suggested by Liam86.

 

Thanks

Nick

Doesn't the SDK just install with the proxy settings set on a machine basis?

Posted

@NPostill If you run 'android --help update sdk' you should get the below options. You can specify the proxy details

 

C:\Program Files (x86)\Android\android-sdk\tools>android --help update sdk

 

 

Usage:

android [global options] update sdk [action options]

Global options:

-h --help : Help on a specific command.

-v --verbose : Verbose mode, shows errors, warnings and all messages.

--clear-cache: Clear the SDK Manager repository manifest cache.

-s --silent : Silent mode, shows errors only.

 

 

Action "update sdk":

Updates the SDK by suggesting new platforms to install if available.

Options:

--proxy-port: HTTP/HTTPS proxy port (overrides settings if defined)

--proxy-host: HTTP/HTTPS proxy host (overrides settings if defined)

-s --no-https : Uses HTTP instead of HTTPS (the default) for downloads.

-a --all : Includes all packages (such as obsolete and non-dependent

ones.)

-f --force : Forces replacement of a package or its parts, even if

something has been modified.

-u --no-ui : Updates from command-line (does not display the GUI)

-p --obsolete : Deprecated. Please use --all instead.

-t --filter : A filter that limits the update to the specified types of

packages in the form of a comma-separated list of

[platform, system-image, tool, platform-tool, doc, sample,

source]. This also accepts the identifiers returned by

'list sdk --extended'.

-n --dry-mode : Simulates the update but does not download or install

anything.

 

Hope that helps.

  • 2 years later...
Posted

To revive an old thread:

 

Just been tasked to install this over the summer ready for next year. It seems like the SDK is now part of the original download.

 

Is anyone here still silently installing this software and has a way that works?

  • 4 years later...
Posted
I've been asked to install this on some of our devices so that staff and students can do development work for some new Pico Neo3 VR headsets we've just got, which are Android devices under the hood. Would also love to know if there's a currently working silent install method.
Posted

This is how I've managed to get a working install within SCCM that our academics seem happy with.

 

Goto https://developer.android.com/studio/run/emulator-acceleration#vm-windows and get the relevant emulator as necessary (HAXM / AEHD)

 

Install Android Studio manually

Launch it and configure the SDK to be stored in C:\AndroidSDK (as well as any other locations you might need)

Download any bits of the SDK that are needed

Create any Virtual devices as needed

 

Create an archive (Winzip, 7Zip, WinRAR - whatever you want. I tend to use 7Zip) of C:\AndroidSDK

Create a 2nd archive containg the .android folder from within your profile, as well as the Google/AndroidStudio folders from within AppData/Local and AppData/Roaming

 

Now using this Powershell script, you can install it

Start-Transcript -Path C:\Windows\Logs\Android_Studio_2023_Install.txt -Force

####### Function PermissionsFixes ############
Function PermissionsFixes
{
# Fix Windows Temp
param($FolderPath,$User,$perms)
$ACL = Get-Acl $FolderPath
#Create new access rule to allow users modify rights
$Ar1 = New-Object System.Security.AccessControl.FileSystemAccessRule($User,$perms,"ContainerInherit, ObjectInherit","None","Allow")
# Add new rule to existing permissions list
$ACL.AddAccessRule($Ar1)
Set-Acl $FolderPath $ACL
}
####### End Function PermissionsFixes ##############

# Install Android Studio
Start-Process .\android-studio-2023.1.1.27-windows.exe -ArgumentList "/S" -Wait

# Add firewall rules
New-NetFirewallRule -DisplayName "OpenJDK Platform binary" -Direction Inbound -Program "C:\Program Files\Android\Android Studio\jre\bin\java.exe" -Profile Domain -Action Allow -Enabled True -Protocol TCP
New-NetFirewallRule -DisplayName "OpenJDK Platform binary" -Direction Inbound -Program "C:\Program Files\Android\Android Studio\jre\bin\java.exe" -Profile Domain -Action Allow -Enabled True -Protocol UDP

New-NetFirewallRule -DisplayName "Android Studio ADB" -Direction Inbound -Program "C:\AndroidStudioSDK\platform-tools\adb.exe" -Profile Domain -Action Allow -Enabled True -Protocol TCP
New-NetFirewallRule -DisplayName "Android Studio ADB" -Direction Inbound -Program "C:\AndroidStudioSDK\platform-tools\adb.exe" -Profile Domain -Action Allow -Enabled True -Protocol UDP

New-NetFirewallRule -DisplayName "Android emulator" -Direction Inbound -Program "C:\androidstudiosdk\emulator\netsimd.exe" -Profile Domain -Action Allow -Enabled True -Protocol TCP
New-NetFirewallRule -DisplayName "Android emulator" -Direction Inbound -Program "C:\androidstudiosdk\emulator\netsimd.exe" -Profile Domain -Action Allow -Enabled True -Protocol UDP


$CPUMan = (Get-WmiObject -class Win32_Processor).Manufacturer

if($CPUMan -eq "GenuineIntel"){
Write-Host "Installing Intel Emulator"
#Start-Process .\HAXM\Silent_Install.bat -Wait
Start-Process .\HAXM\7.6.5\Silent_Install.bat -Wait
}

if($CPUMan -eq "AuthenticAMD"){
Write-Host "Installing AMD Emulator"
Start-Process .\GVM\Silent_Install.bat -Wait
}

Write-Host "Install Android Emulator hypervisor driver"
Start-Process .\GVM\Silent_Install.bat -Wait

Write-Host "Unizipping DU folders"
Start-Process 'C:\Program Files\7-Zip\7z.exe' -ArgumentList "x DUFolders.7z -oC:\Temp\" -Wait

# Copy relevant items into Default users profile
Write-Host "Copying DU folders to DU"
Copy-Item -Path C:\Temp\DUF\* -Destination C:\Users\Default -Recurse -Force

# Copy DU folders into any existing user profiles
$users = Get-ChildItem C:\Users | where{$_.name -notmatch 'Public|default'}

foreach ($user in $users){
Write-Host "Copying DU folders to $User"
Copy-Item -Path C:\Temp\DUF\* -Destination C:\Users\$User -Recurse -Force
}

Remove-Item -Path C:\Temp\DUF -Recurse -Force

Write-Host "Unzipping AndroidStudioSDK folders"
Start-Process 'C:\Program Files\7-Zip\7z.exe' -ArgumentList "x AndroidStudioSDK.7z" -Wait

# Copy relevant items into System drive folder
Write-Host "Copying AndroidStudioSDK to C:"
Copy-Item -Path .\AndroidStudioSDK -Destination C:\AndroidStudioSDK -Recurse -Force

PermissionsFixes C:\AndroidStudioSDK Users Modify

Set-ItemProperty -Path "HKLM:\SOFTWARE\Android Studio" -Name "SdkPath" -Value "C:\AndroidStudioSDK" -Force
Set-ItemProperty -Path "HKLM:\SOFTWARE\Android Studio" -Name "UserSettingsPath" -Value "" -Force

Stop-Transcript

 

The good news is that if you have missed downloading any bits of the SDK, or new features/tools are released then the students can download them as needed.

  • Thanks 1
Posted

@MartinByard This looks really useful, is there a way we can preinstall a specific SDK version so users don't have to / aren't prompted to download it? Our Pico Neo3 devices require API level 29, and the instructions also say not to have an Android Virtual Device.

 

Additionally, the page you linked says that HAXM is being discontinued, but it looks like your script still defaults to that for Intel processors?

 

Also, if we have a mandatory network profile for student users, what do we need to add in there for that to work?

Posted

The API version you download when launching Android Studio before zipping it up is whats present in the SDK when students would launch it, we predownload several but if you know you only need the one then just get that (at least to start with) . By modifying the permissions that allows extra versions to be downloaded if needed without having to use an admin logon. Plus, given the SDK is stored in a central location it applies to all users of that computer.

 

AS.png

 

If you're not using a virtual device, then there would be no reason for installing the HAXM / AEHD. I tried to not use HAXM this year, but for a specific model of PC it still needed it for some reason (this is a bit more of a genreic install script).

 

I've never used a mandatory network profile, but I would presume that instead of unzipping the user folders into each userprofile (and default) then it would need adding to that.

Posted (edited)

I'm running into another problem now, when I'm trying to download the SDK it is saying "unavailable":

 

2024-01-10_10-54-34.png

 

Is there some endpoint or URL that I need to allowlist in our firewall for this to work?

 

EDIT: allowing dl.google.com and dl-ssl.google.com got me past this part but now I am unable to choose the SDK version I need, it only offers the latest one?

 

2024-01-10_10-59-43.png

 

EDIT 2: after allowing it to go through I was then able to go in the SDK Manager and remove the latest Android SDK and install the one I wanted.

Edited by LRSFC_DanJ
  • 5 months later...
Posted
For the Android SDK, tackling the silent installation can be trickier, especially when you need it to install for all users. Have you considered using a script to automate the installation process? With a script, you could potentially install the IDE and SDK in one go, ensuring consistency across all desktops. As for setting up the system variable 'Android_Home', scripting is indeed the way to go. You can use batch scripting or PowerShell to automate the creation of the system variable and set its value to the location of the Android SDK. This way, your students won't need to manually configure anything, saving both time and potential headaches.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...