You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Add Windows Defender exceptions to speed up Android build performance
11
+
# Add Microsoft Defender exceptions to speed up Android build performance
13
12
14
-
This guide covers how to set up exclusions in your Windows Defender security settings in order to improve your build times when developing Android apps using a Windows machine.
13
+
This guide covers how to set up exclusions in your Microsoft Defender security settings in order to improve your build times when developing Android apps using a Windows machine.
15
14
16
-
## Windows Defender Overview
15
+
## Microsoft Defender Antivirus Overview
17
16
18
-
In Windows 10, version 1703 and later, the [Windows Defender Antivirus](/windows/security/threat-protection/windows-defender-antivirus/windows-defender-security-center-antivirus) app is part of Windows Security. Windows Defender aims to keep your PC safe with built-in, real-time protection against viruses, ransomware, spyware, and other security threats.
17
+
In Windows 10, version 1703 and later, the [Microsoft Defender Antivirus](/windows/security/threat-protection/windows-defender-antivirus/windows-defender-security-center-antivirus) app is part of Windows Security. Microsoft Defender aims to keep your PC safe with built-in, real-time protection against viruses, ransomware, spyware, and other security threats.
19
18
20
-
**However**, Windows Defender's real-time protection will also dramatically slow file system access and build speed when developing Android apps.
19
+
**However**, Microsoft Defender's real-time protection will also dramatically slow file system access and build speed when developing Android apps.
21
20
22
21
During the Android build process, many files are created on your computer. With antivirus real-time scanning enabled, the build process will halt each time a new file is created while the antivirus scans that file.
23
22
24
-
Fortunately, Windows Defender has the capability to exclude files, project directories, or file types that you know to be secure from it's antivirus scanning process.
23
+
Fortunately, Microsoft Defender has the capability to exclude files, project directories, or file types that you know to be secure from it's antivirus scanning process.
25
24
26
25
> [!WARNING]
27
-
> To ensure that your computer is safe from malicious software, you should not completely disable real-time scanning or your Windows Defender antivirus software.
26
+
> To ensure that your computer is safe from malicious software, you should not completely disable real-time scanning or your Microsoft Defender antivirus software.
28
27
> Defining exclusions lowers the protection offered by Defender. You should always evaluate the risks that are associated with implementing exclusions, and only exclude files that you are confident are not malicious.
29
28
30
-
## How to add exclusions to Windows Defender
29
+
## How to add antivirus exclusions to Microsoft Defender
31
30
32
-
To add exclusions in the [Windows Defender Security Center](windowsdefender://):
31
+
To add exclusions in the [Microsoft Defender Security Center](windowsdefender://):
33
32
34
33
1. Select the Windows menu **Start** button
35
34
2. Enter **Windows Security**
@@ -38,18 +37,16 @@ To add exclusions in the [Windows Defender Security Center](windowsdefender://):
38
37
5. Scroll to the **Exclusions** heading and select **Add or remove exclusions**
39
38
6. Select **+ Add an exclusion**. You will then need to choose whether the exclusion you wish to add is a **File**, **Folder**, **File type**, or **Process**.
The following list shows the default location of each Android Studio directory that could be added as an exclusion from Windows Defender real-time scanning:
44
+
Use Microsoft Defender Antivirus exclusions sparingly. See [Configure custom exclusions for Microsoft Defender Antivirus](/microsoft-365/security/defender-endpoint/configure-exclusions-microsoft-defender-antivirus) for more details about using exclusions.
46
45
47
-
- Gradle cache: `%USERPROFILE%\.gradle`
48
-
- Android Studio projects: `%USERPROFILE%\AndroidStudioProjects`
- Android Studio system files: `%USERPROFILE%\.AndroidStudio<version>\system`
46
+
Microsoft Defender Antivirus interprets *user environment variables* in the context of the system user, using the LocalSystem account, which means it gets information from the system environment variable, and not from the user environment variable. See [Using incorrect environment variables as wildcards in the file name and folder path or extension exclusion lists](/microsoft-365/security/defender-endpoint/common-exclusion-mistakes-microsoft-defender-antivirus#using-incorrect-environment-variables-as-wildcards-in-the-file-name-and-folder-path-or-extension-exclusion-lists). You can find a list of [System environment variables](/microsoft-365/security/defender-endpoint/configure-extension-file-exclusions-microsoft-defender-antivirus#system-environment-variables) in the Microsoft Defender for Endpoint documentation. You can also [Use wildcards in the file name and folder path or extension exclusion lists](/microsoft-365/security/defender-endpoint/configure-extension-file-exclusions-microsoft-defender-antivirus#use-wildcards-in-the-file-name-and-folder-path-or-extension-exclusion-lists). This explains the use of the asterisk `*`, question mark `?`, or environment variables (such as `%ALLUSERSPROFILE%`) as wildcards when defining items in the file name or folder path exclusion list. The way these wildcards are interpreted differs from their usual usage in other apps and languages.
51
47
52
-
These directory locations may not apply to your project if you have not used the default locations set by Android Studio or if you have downloaded a project from GitHub (for example). Consider adding an exclusion to the directory of your current Android development project, wherever that may be located.
48
+
Microsoft Defender Antivirus expands `%USERPROFILE%` to `C:\Windows\system32\config\systemprofile`, not a wildcard expression applying to all user profiles. Instead of `%USERPROFILE%`
49
+
, for a single user scenario use a pre-expanded user environment variable. For example: `"${env:UserProfile}\AndroidStudioProjects"` or, for the all users scenario, use a wildcard pattern like: `"%SystemDrive%\Users\*\AndroidStudioProjects"` to include Android Studio project files.
53
50
54
51
Additional exclusions you may want to consider include:
55
52
@@ -61,13 +58,13 @@ For more information on adding antivirus scanning exclusions, including how to c
61
58
62
59
Please remember that adding exclusions lowers the protection offered by Defender. You should always evaluate the risks that are associated with implementing exclusions, and only exclude files that you are confident are not malicious.
63
60
64
-
> [!Note]
65
-
> Daniel Knoodle has set up a GitHub repo with recommended scripts to add [Windows Defender exclusions for Visual Studio 2017](https://gist.github.com/dknoodle/5a66b8b8a3f2243f4ca5c855b323cb7b#file-windows-defender-exclusions-vs-2017-ps1-L10).
61
+
> [!NOTE]
62
+
> Daniel Knoodle has set up a GitHub repo with recommended scripts to add [Microsoft Defender exclusions for Visual Studio 2017](https://gist.github.com/dknoodle/5a66b8b8a3f2243f4ca5c855b323cb7b#file-windows-defender-exclusions-vs-2017-ps1-L10).
66
63
67
64
## Additional resources
68
65
69
66
-[Develop Dual-screen apps for Android and get the Surface Duo device SDK](/dual-screen/android/)
70
67
71
-
-[Add Windows Defender exclusions to improve performance](./defender-settings.md)
68
+
-[Add Microsoft Defender exclusions to improve performance](./defender-settings.md)
72
69
73
70
-[Enable Virtualization support to improve emulator performance](./emulator.md#enable-virtualization-support)
0 commit comments