Configure Android Studio
studio.vmoptions
idea.properties
- Create and manage virtual devices
- Run apps on a hardware device
- Install OEM USB drivers
- JDKs Android Builds Java versions in Android builds.
- Oracle’s Java HotSpot VM Options page
- See Share IDE settings at IntelliJ IDEA
- Android Studio by debugging on a physical device
- see Declare dependencies for Google Play services
- Set up the Android Studio proxy See HTTP Proxy.
- https://developer.android.com/build/building-cmdline
Configure Environment
STUDIO_JDK
environment variablestudio.jdk
directory (in the Android Studio distribution)jbr
directory (JetBrains Runtime), in the Android Studio distribution. Recommended.JDK_HOME
environment variableJAVA_HOME
environment variablejava
executable in thePATH
environment variable
Command-line tools
apkanalyzer
Provides insight into the composition of your APK after the build process is completed.avdmanager
Lets you create and manage Android Virtual Devices (AVDs) from the command line.lint
Scans code to help you identify and correct problems with the structural quality of your code.retrace
For applications compiled by R8,retrace
decodes an obfuscated stack trace that maps back to your original source code.sdkmanager
-
Located in:
android_sdk/build-tools/version/
See SDK Build Tools release notes for more information. This package is required to build Android apps. Most of the tools in this package are invoked by the build tools and are not intended for you. However, the following command-line tools might be useful:AAPT2
Parses, indexes, and compiles Android resources into a binary format that is optimized for the Android platform and packages the compiled resources into a single output.apksigner
Signs APKs and checks whether APK signatures will be verified successfully on all platform versions that a given APK supports.zipalign
Optimizes APK files by ensuring that all uncompressed data starts with a particular alignment relative to the start of the file. -
Android SDK Platform Tools: Located in:
android_sdk/platform-tools/
See SDK Platform Tools release notes for more information. These tools are updated for every new version of the Android platform to support new features and fix or improve the tools, and each update is backward compatible with earlier platform versions. In addition to downloading from the SDK Manager, you can download the SDK Platform Tools here.adb
Android Debug Bridge (adb) is a versatile tool that lets you manage the state of an emulator instance or Android-powered device. You can also use it to install an APK on a device.etc1tool
A command-line utility that lets you encode PNG images to the ETC1 compression standard and decode ETC1 compressed images back to PNG.fastboot
Flashes a device with platform and other system images. For flashing instructions, see Factory Images for Nexus and Pixel Devices.logcat
Invoked by adb to view app and system logs. -
Android EmulatorLocated in:
android_sdk/emulator/
See Android Emulator release notes for more information. This package is required to use the Android Emulator. It includes the following:emulator
A QEMU-based device-emulation tool that you can use to debug and test your applications in an actual Android run-time environment.mksdcard
Helps you create a disk image that you can use with the emulator to simulate the presence of an external storage card, such as an SD card.
Android plugin for Gradle HTTP proxy settings
When running the Android plugin from the command line or on machines where Android Studio is not installed, set the Android Gradle plugin proxy settings in the Gradle build file.
For application-specific HTTP proxy settings, set the proxy settings in the build.gradle
file as required for each application module:
plugins {
id 'com.android.application'
}
android {
...
defaultConfig {
...
systemProp.http.proxyHost=proxy.company.com
systemProp.http.proxyPort=443
systemProp.http.proxyUser=userid
systemProp.http.proxyPassword=password
systemProp.http.auth.ntlm.domain=domain
}
...
}
For project-wide HTTP proxy settings, set the proxy settings in the gradle/gradle.properties
file:
# Project-wide Gradle settings.
...
systemProp.http.proxyHost=proxy.company.com
systemProp.http.proxyPort=443
systemProp.http.proxyUser=username
systemProp.http.proxyPassword=password
systemProp.http.auth.ntlm.domain=domain
systemProp.https.proxyHost=proxy.company.com
systemProp.https.proxyPort=443
systemProp.https.proxyUser=username
systemProp.https.proxyPassword=password
systemProp.https.auth.ntlm.domain=domain
...
The following list shows the default location of each Android Studio directory that you can exclude from real-time scanning:
...
systemProp.http.proxyHost=proxy.company.com
systemProp.http.proxyPort=443
systemProp.http.proxyUser=username
systemProp.http.proxyPassword=password
systemProp.http.auth.ntlm.domain=domain
systemProp.https.proxyHost=proxy.company.com
systemProp.https.proxyPort=443
systemProp.https.proxyUser=username
systemProp.https.proxyPassword=password
systemProp.https.auth.ntlm.domain=domain
...
- Gradle cache
%USERPROFILE%\.gradle
- Android Studio projects
%USERPROFILE%\AndroidStudioProjects
- Android SDK
%USERPROFILE%\AppData\Local\Android\SDK
Android Studio system files
Syntax: %LOCALAPPDATA%\Google\<product><version>
Example: C:\Users\YourUserName\AppData\Local\Google\AndroidStudio4.1
Customize directory locations for Group Policy controlled environments
If a Group Policy limits which directories you can exclude from real-time scanning on your computer, you can move your Android Studio directories to one of the locations that the centralized Group Policy already excludes.
The following list shows how to customize the location of each Android Studio directory, where C:\WorkFolder
is the directory that your Group Policy already excludes:
- Gradle cache
- Define the
GRADLE_USER_HOME
environment variable to point toC:\WorkFolder\.gradle
. - Android Studio projects
- Move or create project directories in an appropriate subdirectory of
C:\WorkFolder
. For example,C:\WorkFolder\AndroidStudioProjects
. - Android SDK
-
Follow these steps to customize location:
-
In Android Studio, open the Settings dialog (Preferences on macOS), then navigate to Appearance & Behavior > System Settings > Android SDK.
-
Change the value of the Android SDK Location to
C:\WorkFolder\AndroidSDK
.To avoid downloading the SDK again, copy the existing SDK directory, located at
%USERPROFILE%\AppData\Local\Android\SDK
by default, to the new location.
-
- Android Studio system files
-
Follow these steps to customize location:
-
In Android Studio, click Help > Edit Custom Properties.
Android Studio prompts you to create an
idea.properties
file if you don’t already have one. -
Add the following line to your
idea.properties
file:idea.system.path=c:/workfolder/studio/caches/trunk-system
-