As we here test mobile applications, we need to set up some additional tools:
- Java JDK (11 or 17+) – Appium’s Android driver uses Java tooling.
- side note: the latest version is JDK 24. So why we use 17? Because it’s the most widely tested combo today. The “latest” (e.g., JDK 24) is a non-LTS release and some Android tools/drivers can be picky with bleeding-edge Java versions. LTS releases (11, 17, 21) get long-term fixes and are what Android tooling and Appium ecosystems are validated against most.
- Android SDK / Android Studio – gives you the emulator (AVD) and
adb. - Appium 2 + Android driver (UiAutomator2) – the server Appium runs.
Install Java JDK 17
- https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html
- in VS Code open a new terminal (terminal and the + icon) and verify:
java -version
javac -versionCommon issue: “java is not recognized” on Windows.
If you face this problem, here’s teh solution and the explanation why could it occur:
Running
java -version
javac -version
returned “not recognized” (or pointed to Common Files\Oracle\Java\javapath...).
Why: Windows PATH/JAVA_HOME wasn’t set to the real JDK folder; sometimes installers add only a forwarder (javapath_*) which isn’t a true JDK home.
You can easily auto-find and set the right path with PowerShell:
- Find the real javac.exe outside any 'javapath' folder, by running the below lines:
- Derive the JDK root from that path
- Set user env vars
- for verification, open a new terminal:
$realJavac = Get-ChildItem 'C:\Program Files','C:\Program Files (x86)' -Recurse -Filter javac.exe -ErrorAction SilentlyContinue |
Where-Object { $_.FullName -notmatch 'javapath' } |
Select-Object -First 1 -Expand FullName$realRoot = Split-Path -Parent (Split-Path -Parent $realJavac)setx JAVA_HOME "$realRoot"
setx PATH "$($env:PATH);%JAVA_HOME%\bin"java -version
javac -version
$env:JAVA_HOMEExpected result:
java -version→17.x(LTS)javac -version→17.xJAVA_HOME→ your JDK folder, e.g.C:\Program Files\Java\jdk-17.0.12
Java is correctly configured on Windows. We can now install Android tools (Android Studio/SDK), create an emulator, and move on to Appium.
Installing Android Studio
downlad and install Android Studio:
Once installed, open the SDK Manager under More Actions
Install/ensure:
- Android SDK Platform (API 34 is fine)
- Android SDK Platform-Tools (gives
adb) - Android Emulator
Switch to SDK Tools tab:
- Tick Android SDK Platform-Tools (gives
adb) - Tick Android Emulator
- (optional but nice) Android SDK Command-line Tools (latest)
Create & start an emulator
- Back on the Welcome screen: More Actions ▾ → Virtual Device Manager (or Device Manager).
- Create Device… → choose Pixel 5 (any Pixel is fine).
- Pick a Google APIs (or Google Play) system image for your API (e.g., API 34), click Download if needed, then Next → Finish.
- In Device Manager, click Start (►) to launch the emulator.
Installing Appium 2 (server + driver)
Just like PlayWright, Appium is a Node package, so we install it with npm.
Open PowerShell and run:
npm i -g appium
appium -v
appium driver install uiautomator2 Then start the server in its own terminal:
appiumKeep the current PowerShell window open running Appium.
Open your test folder in VS Code (appium_test)
Paste in the terminal:
npm init -y
npm i -D selenium-webdriver mocha chaiOpen package.json, ctrl+a and set:
Create a tests folder, and in a new file: mobile_web.spec.js, and set:
Then run the test, and see it running through your emulator, openin Android Chrome and navigated to example.org.