appium driver install uiautomator2 fails or the driver will not start
Error installing uiautomator2 driverShort answer
Run appium driver install uiautomator2 with the Appium server stopped, on a Node.js and npm version Appium supports (Node ^20.19, ^22.12 or 24+, npm 10+). Then run appium driver doctor uiautomator2: it reports the missing Android SDK, ANDROID_HOME or JAVA_HOME.
Fix it fast
1Find out which cause you have
Check the Node.js and npm versions first; Appium documents the range it supports.
node --version npm --version2Match what you see, then jump to its fix
- 1
node --version prints a version outside the supported rangeNode.js or npm is older than Appium supportsFix - 2
Install ends in an error while appium is running in another terminalThe Appium server is still runningFix - 3
The driver installs but sessions fail, or the doctor reports required fixesThe Android SDK or JDK environment is not setFix
- 1
What does the error look like?
Error installing uiautomator2 driver
Cause 1 of 3
Node.js or npm is older than Appium supports
1Check
Appium's requirements page asks for Node.js ^20.19.0 || ^22.12.0 || >=24.0.0 and npm 10 or newer.
node --version && npm --version2Fix
Install a supported LTS Node.js (npm comes with it), then install Appium and the driver again.
npm install -g appium
appium driver install uiautomator23Verify
The driver shows as installed.
appium driver doctor uiautomator2Confirmed by appium.io
Cause 2 of 3
The Appium server is still running
1Check
The UiAutomator2 quickstart tells you to stop the Appium server before installing the driver.
ps aux | grep -i [a]ppium2Fix
Stop the server, run the install, then start the server again.
appium driver install uiautomator2
appium3Verify
The doctor check for uiautomator2 runs without an install error.
appium driver doctor uiautomator2Confirmed by appium.io
Cause 3 of 3
The Android SDK or JDK environment is not set
1Check
The driver needs the Android SDK (Platform and Platform-Tools), a JDK (not a JRE), and ANDROID_HOME and JAVA_HOME pointing at them. The doctor command checks these.
appium driver doctor uiautomator22Fix
Set the variables to the SDK root and the JDK home, then run the doctor again until it reports 0 required fixes needed.
export ANDROID_HOME="$HOME/Library/Android/sdk" # your SDK root
export JAVA_HOME="/path/to/jdk"3Verify
The doctor reports 0 required fixes needed.
appium driver doctor uiautomator2Confirmed by appium.io
How do I stop it coming back?
- Keep Node.js on a supported LTS and upgrade it before upgrading Appium.
- Set ANDROID_HOME and JAVA_HOME in your shell profile so every terminal has them.
- Run the doctor command after changing the SDK or the JDK.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
Related fixes
Mobile apps
Appium returns 'The requested resource could not be found' (404)
http://localhost:4723/wd/hub
The client is calling a URL the server does not serve.
2 causes, each with a fixMobile apps
Capacitor does not find index.html for a Vue app inside Laravel
the web app files are not found by Capacitor after npx cap sync
Capacitor copies the folder named in webDir, and that folder must hold the final index.html.
3 causes, each with a fixMobile apps
Expo cannot start the Android emulator: spawn adb ENOENT
spawn adb ENOENT
ENOENT means the tool that launched adb could not find an executable named adb on your PATH.
3 causes, each with a fixMobile apps
npm install --global expo-cli fails, or the legacy expo-cli will not run on new Node.js
The legacy expo-cli does not support Node +17
The global expo-cli is the legacy tool: its repository is archived and read-only.
2 causes, each with a fixMobile apps
Expo says it is unable to find expo in this project
Unable to find expo in this project - have you run yarn / npm install yet?
The Expo CLI ships inside the expo package, so the project must have expo as a dependency and installed in its own node_modules.
3 causes, each with a fixMobile apps
FCM rejects the message with INVALID_ARGUMENT
HTTP 400 from fcm.googleapis.com/v1/projects/PROJECT_ID/messages:send
INVALID_ARGUMENT is HTTP 400: FCM did not accept the request parameters.
3 causes, each with a fix