This Appium error is sometimes misleading. Here is how I fixed this error.
Check if Path variables are present
Check if the $ANDROID_HOME and$ JAVA_HOME path variables are set. Also check if the path variables are added to the $PATH. You can add these variables by adding these lines to your ~/.bashrc file:
export ANDROID_HOME=~/Android/Sdk export PATH=$PATH:$ANDROID_HOME/tools export PATH=$PATH:$JAVA_HOME/bin source ~/.bashrc
Install Appium doctor
Sometimes we miss other things in our setup. The best way forward is to start appium doctor. You can install appium doctor by:
npm install appium-doctor -g $ appium-doctor
Thats how the appium doctor check should look like:
Restart Appium in a new terminal
Yes this is required if you have made PATH changes. Appium should be restarted in a new terminal to get the path changes.
Alternatively, closing Appium, running source on ~/.bashrc and restarting Appium also works. But restarting Appium in a new terminal is always a safer option.
That’s all for this post. Hope it helps.
If you have still not solved the issue please run appium in debug mode and post the error logs here in comments:
$ appium --debug