Install/Run Appium On ARM64 Ubuntu 22.04


Overview


  • Install these packages to run Appium
    • node.js
    • android-sdk
    • adb
    • appium & drivers
    • appium-doctor

Installation


INSTALL Node.js

# Update the OS to the latest
$ sudo apt update && sudo apt upgrade -y

# If the nodejs version you installed less than 18.0.0, which means it can't supports Appoim 2.x, you need download an newer one and install it.
$ sudo apt install curl -y
$ curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash 
$ sudo apt install nodejs

# Verify nodejs has been installed
$ node -v
 v20.14.0
# Verify npm has been installed
$ npm -v
 v10.8.1

INSTALL android-sdk and adb

# Install android-sdk
$ sudo apt install android-sdk
# Install adb
$ sudo apt install adb

SET ANDROID_HOME and PATH

# Find the locate of android-sdk
$ whereis android-sdk
 android-sdk: /usr/lib/android-sdk
# Append $ANDROID_HOME and $PATH environment variables in ~/.bashrc
$ cd $HOME
$ echo 'export ANDROID_HOME=/usr/lib/android-sdk' >> ~/.bashrc
$ echo 'export PATH=$PATH:$ANDROID_HOME/tools' >> ~/.bashrc
$ echo 'export PATH=$PATH:$ANDROID_HOME/platform-tools' >> ~/.bashrc
# Activate
$ source ~/.bashrc

INSTALL appium and drivers

# Install appium
$ sudo npm install -g appium

# Install drivers
# For Android device.
$ appium driver install uiautomator2
# For iOS device.
$ appium driver install xcuitest

DIAGNOSTIC

# When the installation steps finished, let's install appium-doctor for diagnostic.

# Install appium-doctor
$ sudo npm install -g appium-doctor

# Execute "appium-doctor" command and make sure the necessary dependencies of diagnostic should be passed excepted "✖ android, emulator, apkanalyzer could NOT be found in /usr/lib/android-sdk/!".
$ appium-doctor
WARN AppiumDoctor [Deprecated] Please use appium-doctor installed with "npm install @appium/doctor --location=global"
info AppiumDoctor Appium Doctor v.1.16.2
info AppiumDoctor ### Diagnostic for necessary dependencies starting ###
info AppiumDoctor  ✔ The Node.js binary was found at: /usr/bin/node
info AppiumDoctor  ✔ Node version is 20.14.0
info AppiumDoctor  ✔ ANDROID_HOME is set to: /usr/lib/android-sdk/
info AppiumDoctor  ✔ JAVA_HOME is set to: /usr/lib/jvm/java-11-openjdk-arm64
info AppiumDoctor    Checking adb, android, emulator, apkanalyzer
info AppiumDoctor      'adb' is in /usr/lib/android-sdk/platform-tools/adb
WARN AppiumDoctor  ✖ android, emulator, apkanalyzer could NOT be found in /usr/lib/android-sdk/!
info AppiumDoctor  ✔ 'bin' subfolder exists under '/usr/lib/jvm/java-11-openjdk-arm64'
info AppiumDoctor ### Diagnostic for necessary dependencies completed, one fix needed. ###
info AppiumDoctor
...

VERIFY appium server can be executable

# Verify appium server can be executable and it expected printed logs likes below.
# Make sure the appium server version starts with v2.x
$ appium
[Appium] Welcome to Appium v2.6.0
[Appium] The autodetected .....

RUN Appium Server

# The execution command format likes below:
$ appium [-a ADDRESS] [-p port] [desired capabilities] [--log=$output_path]

# Here is my frequently used example.
$ appium -a 127.0.0.1 -p 4723 --allow-cors --session-override --relaxed-security --log-timestamp --local-timezone --log=C:\\adb_log\\appium_server_%date:~0,4%%date:~5,2%%date:~8,2%_%Time:~0,2%%Time:~3,2%%Time:~6,2%.log
# The output log will be created automatically by current time, to acheive it, you need create a adb_log folder under C disk and set time format.
# The %date% & %time% format on computer should be "2024-06-03" "17:04:06.54".

Reference


#appium #arm64 #ubuntu #raspberry pi #node.js






你可能感興趣的文章

了解 AJAX 非同步觀念

了解 AJAX 非同步觀念

MTR04_0712

MTR04_0712

React原理 - Virtual DOM

React原理 - Virtual DOM






留言討論