Skip to content

Commit 6780de4

Browse files
committed
fix(windows): setup guide for env
1 parent 0765cc5 commit 6780de4

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

content/setup/windows.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ You may need to restart your terminal for changes to apply.
9999
[Download and install Android Studio](https://developer.android.com/studio). In the installation wizard make sure you have the following components selected (the list should appear if you select **custom** options):
100100

101101
- Android SDK
102+
- Android SDK Build-Tools
102103
- Android SDK Platform
103104
- Android Virtual Device
104105
- Performance (Intel ® HAXM) — optional, learn more about [AMD Processor & Hyper-V support](https://android-developers.googleblog.com/2018/07/android-emulator-amd-processor-hyper-v.html)
@@ -107,6 +108,15 @@ The setup may take a while, but once it has finished a welcome screen should app
107108

108109
Android Studio installs the latest Android SDK by default, which in most cases should be all that's needed to build a NativeScript app.
109110

111+
After Android Studio finishes installing, open **Settings > Languages & Frameworks > Android SDK** and confirm the SDK path shown there matches the path you will use for `ANDROID_HOME`.
112+
113+
Then verify the following components are installed:
114+
115+
- Under **SDK Platforms**: at least one recent Android SDK Platform
116+
- Under **SDK Tools**: **Android SDK Build-Tools** and **Android SDK Platform-Tools**
117+
118+
If `ns doctor android` later reports that no compatible Android SDK Build-Tools are installed, return to this screen and install a recent Build-Tools version.
119+
110120
### Configuring `ANDROID_HOME` and `PATH`
111121

112122
Configure the `ANDROID_HOME` environment variable for NativeScript to be able to find the Android SDK.
@@ -156,6 +166,25 @@ ns doctor android
156166

157167
If you see **No issues were detected** then you have successfully set up your system.
158168

169+
If not, verify the values NativeScript will resolve from your shell:
170+
171+
```bat
172+
echo %JAVA_HOME%
173+
javac --version
174+
where javac
175+
echo %ANDROID_HOME%
176+
where adb
177+
dir "%ANDROID_HOME%\build-tools"
178+
```
179+
180+
Expected results:
181+
182+
- `javac --version` prints a Java version
183+
- `where javac` points to your JDK `bin` folder
184+
- `echo %ANDROID_HOME%` prints the Android SDK path configured in Android Studio
185+
- `where adb` points to `%ANDROID_HOME%\platform-tools\adb.exe`
186+
- `dir "%ANDROID_HOME%\build-tools"` shows one or more installed Build-Tools versions
187+
159188
If you're using Chocolatey and prefer not to open a new terminal, you can refresh your environment variables in the current PowerShell session by running:
160189

161190
```bash
@@ -166,10 +195,24 @@ Update-SessionEnvironment
166195
After refreshing, run the `ns doctor` command again to confirm everything is working as expected.
167196

168197

198+
::: tip Common issues on Windows
199+
200+
If you installed Chocolatey, the JDK, or Android Studio after opening your terminal or VS Code, close all existing terminal windows and open a new one before running `ns doctor android` again. In some cases you may also need to fully restart VS Code.
201+
202+
If Android Studio uses a custom SDK location, make sure `ANDROID_HOME` points to that exact location instead of the default `%LOCALAPPDATA%\Android\Sdk` path.
203+
204+
:::
205+
169206
Lastly, you will also want to [set up an android device](/guide/running#enable-usb-debugging-on-android-devices) or [emulator](/guide/running#android-emulators).
170207

171208
::: warning Troubleshooting
172209

210+
If `ns doctor android` reports **No compatible version of the Android SDK Build-tools are installed on your system**, open Android Studio and go to **Settings > Languages & Frameworks > Android SDK > SDK Tools**, then install or update **Android SDK Build-Tools**.
211+
212+
If `ns doctor android` reports **Error executing command `javac`**, verify both `JAVA_HOME` and your `Path` are configured correctly, then confirm `javac --version` works in a new terminal window.
213+
214+
If `ANDROID_HOME` seems correct but NativeScript still cannot find the SDK, verify the path from `echo %ANDROID_HOME%` matches the Android Studio SDK location exactly and that `platform-tools` and `build-tools` exist inside that folder.
215+
173216
If any of the above failed, we recommend asking in [our Community Discord](https://nativescript.org/discord) for assistance.
174217

175218
:::

0 commit comments

Comments
 (0)