Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Flutter and app store releases

appium driver install uiautomator2 fails or the driver will not start

ErrorError installing uiautomator2 driver

Short 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.

  • Applies to Appium 3, Node.js 22, npm 10
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Check the Node.js and npm versions first; Appium documents the range it supports.

    node --version
    npm --version
  2. 2Match what you see, then jump to its fix

    1. 1node --version prints a version outside the supported rangeNode.js or npm is older than Appium supportsFix
    2. 2Install ends in an error while appium is running in another terminalThe Appium server is still runningFix
    3. 3The driver installs but sessions fail, or the doctor reports required fixesThe Android SDK or JDK environment is not setFix

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 --version

2Fix

Install a supported LTS Node.js (npm comes with it), then install Appium and the driver again.

npm install -g appium
appium driver install uiautomator2

3Verify

The driver shows as installed.

appium driver doctor uiautomator2

Confirmed by appium.io

Did this fix it?

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]ppium

2Fix

Stop the server, run the install, then start the server again.

appium driver install uiautomator2
appium

3Verify

The doctor check for uiautomator2 runs without an install error.

appium driver doctor uiautomator2

Confirmed by appium.io

Did this fix it?

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 uiautomator2

2Fix

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 uiautomator2

Confirmed by appium.io

Did this fix it?

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

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 fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.