/build/static/layout/Breadcrumb_cap_w.png
07/27/2018 3456 views
I've spent much more time than I should trying to create an unattended installation of Android Studio for lab computers. The program is designed to allow each user to customize their installation by saving program data to each user's App Data folder. In practice, this means that each student that sits down at a lab machine has to launch the software and then initiate a 1+GB download, install, and program restart.

This is a round-about way to solve this problem, but after scouring online tips, not finding any concise instructions for enterprise installations, and attempting older documentation that I couldn't get working, the solution I settled on for deploying to all users on lab machines is as follows:

Post-installation step 1 - Install Android Studio

android-studio-ide-VERSION.NUMBER-windows.exe /S /Allusers

Post-installation step 2 - create all-user access to by-design user-profile-based sdk files
On a clean test machine, launch Android Studio and install updates. Save the contents of the updated user's "AppData\Local\Android\Sdk" folder.
Create a second post-installation task that does the following (I'd separated this task from the actual installation for troubleshooting):
  1. copies the saved content from the \AppData\Local\Android\Sdk folder above into a custom folder in "C:\Program Files\Android\"
  2. puts a script in "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup\" that creates a hard link from "%USERPROFILE%\AppData\Local\Android\Sdk" to "C:\Program Files\Android\custom"
This seems to work. When a new user logs in and launches Android Studio, it sees that is is up to date and does not prompt for an additional 1+GB download, installation, and program restart. The default project file is still in the user's own profile.

Does anyone else have a better way to set up Android Studio for all users?



1 Comment   [ + ] Show comment

Comments

  • Question: Are the accounts in the lab local admins on the machines? I was under the impression that you had to be a local admin to make a junctions/symbolic link in the user directory.
    • the link creates just fine with user rights. I have discovered, though, that I will need to adjust permissions on the custom folder.
      • Yea I ran into that issue. I was originally putting it in the Android Studio Install folder but ended up making a new folder in the root of C: and that seems to work just fine.

        Thanks a ton for figuring all this out and then posting about it. You were are a life saver!

All Answers

0

Hi, I've got an other solution that work fine

1) Log on with an authorized accound for install completely AS with /S /Allusers (for install Studio in c:\program files\...)

2) go to the folder "%USERPROFILE%\AppData\Local\Android\Sdk" and copy/paste all the items in folder (for ex.) "c:\androidcustom"

3) compress it in "androidcustim.zip" file (for win time to the copy process later)

4) make a powershell file with the code below. Save as "c:\temp\CopieAndroidSDK.ps1" :

function Extract-ZipFile

{

    [CmdletBinding()]

    param(

            [Parameter(Mandatory=$true)]

            [string]

            [ValidateNotNullOrEmpty()]

            $Name,

            [Parameter(Mandatory=$true)]

            [string]

            [ValidateNotNullOrEmpty()]

            $Destination

    )

    [Reflection.Assembly]::LoadWithPartialName( "System.IO.Compression.FileSystem" )

    [System.IO.Compression.ZipFile]::ExtractToDirectory($Name,$Destination)

    Get-Item $Destination

}

write-host Extraction en cours. Merci de patienter environ 3min...

$sdk = $env:USERPROFILE + '\appdata\local\android\sdk'

New-Item -type directory -path $sdk

#$SDK = $env:USERPROFILE + '\appdata\local\android\sdk'

Extract-ZipFile -Name C:\temp\androidcustom.zip -Destination $sdk

write-host Extraction terminée.

Start-Sleep -s 30

5) Logoff and logon with a regular account

6) Execute "c:\temp\CopieAndroidSDK.ps1"

7) When finished, run AS

8) At startup, the wizard comes; answer to the little questions. At last screen, it will wrote "nothing to do, up to date!" 


nota : if you make not the ".zip" file, the copy process (+40'000files) takes more time (~8 minutes). With compressed files : ~3 minutes.

:-)


Answered 01/24/2019 by: serviceinfo
White Belt