Here you can find a number of PowerShell scripts to make Android Studio portable. To run the scripts you need PowerShell version 2.0 or higher.
-
Setup-AndroidStudioPortable.ps1
- Downloads aria2 and unpacks its archive.
- Downloads lessmsi and unpacks its archive.
- Downloads 7-Zip and unpacks its installer with lessmsi.
- Downloads the Android SDK and unpacks its archive with 7-Zip as .Net libraries can't handle long file names inside.
- Downloads Android Studio and unpacks its archive.
- Downloads the Oracle JDK installer and unpacks it with 7-Zip.
- Unpacks
.pack
files in the JDK directory into.jar
files with the unpack200 utility bundled with the JDK. - Removes all aria2, lessmsi and 7-Zip files with the SDK, Studio, and JDK archives and installers.
- Generates a batch file to start an Android Studio instance without PowerShell.
-
Start-AndroidStudioPortable.ps1
-
Sets environment variables relative to the current directory.
HOMEPATH
(_~_)USERPROFILE
(_~_)ANDROID_HOME
(Android SDK root)ANDROID_SDK_HOME
(~\.android)GRADLE_USER_HOME
(~\.gradle)JAVA_HOME
(JDK root)
-
Adds directories with executables from the SDK and JDK at the beginning of the
PATH
environment variable for use in the Android Studio terminal.- JDK bin directory
- Android Studio bin directory
- Android SDK tools and platform-tools directories
-
-
Remove-AndroidStudioPortable.ps1
- Removes all aria2, lessmsi and 7-Zip files with the SDK, Studio, and JDK archives and installers.
- Removes the unpacked SDK, Studio, and JDK directories but leaves the portable home directory along.
-
AndroidStudioPortable-Definitions.ps1
- Contains definitions for URLs, file/directory names, and parameters used by other scripts.
- Can be modified to install a different version of a certain package.
-
AndroidStudioPortable-Helpers.ps1
- Contains helper functions and shims to support old PowerShell versions.
-
The scripts don't touch your project files in any way or form. That means you will have to update the path to the Android SDK and Oracle JDK directories in your project settings from time to time.
-
In an environment with a
Restricted
PowerShell execution policy you have to start scripts in the following wayPowerShell.exe -ExecutionPolicy Bypass -File <a script file name to start>
-
Network (or UNC) paths are not supported.
-
SD card and skin paths for AVDs are not automatically updated.