How to complete appium-doctor (Android part)

소찬 (Chan)·2022년 8월 29일
0
post-thumbnail

Let's do unfinished items from Android part.

appium-doctor --android
WARN AppiumDoctor ✖ ANDROID_HOME environment variable is NOT set!
WARN AppiumDoctor ✖ JAVA_HOME environment variable is NOT set!
WARN AppiumDoctor ✖ adb, android, emulator could not be found because ANDROID_HOME or ANDROID_SDK_ROOT is NOT set!
WARN AppiumDoctor ✖ Cannot check $JAVA_HOME requirements since the environment variable itself is not set
WARN AppiumDoctor ✖ bundletool.jar cannot be found
WARN AppiumDoctor ✖ gst-launch-1.0 and/or gst-inspect-1.0 cannot be found

ANDROID_HOME

First, install Android Studio
https://developer.android.com/studio

After the installation, finish Wizard steps.

And we need a virtual device at least one. Create empty project and launch Device Manager.

Select a device for testing and proceed the installation.

If the installation finished, directory named tools is created in sdk folder.

  • $ANDROID_HOME
    /Users/{user_id}/Library/Android/sdk

  • android
    $ANDROID_HOME/tools

We will set $ANDROID_HOME and android command path all together last.

JAVA_HOME

For setting JAVA_HOME, install Java SE Development Kit first.
https://www.oracle.com/java/technologies/downloads/
After installation, check the version java --version

java 18... 2022-xx-xx
Java(TM) SE Runtime Environment (build 18...)

For checking JAVA_HOME path, command /usr/libexec/java_home then you can find out the JAVA_HOME path.

% /usr/libexec/java_home
/Library/Java/JavaVirtualMachines/jdk-xxxx(version number).jdk/Contents/Home

Link above path to JAVA_HOME. Link also all together last with ANDROID_HOME.

bundletool.jar

Download bundle-tools latest file from github.
https://github.com/google/bundletool/releases

  • cd $ANDROID_HOME
  • mkdir bundle-tool

Now send the bundle-tool file from github to $ANDROID_HOME/bundle-tool folder.
The file name should be changed to bundletool.jar

  • mv bundletool-all-1.11.0.jar $ANDROID_HOME/bundle-tool/bundletool.jar

And then go to $ANDROID_HOME/bundle-tool folder, add access privilege to bundletool.jar.

  • chmod +x bundletool.jar

bundletool.jar setting is done.

.bash_profile

Why I mention .bash_profile,
We should set ANDROID_HOME and JAVA_HOME every launching terminal with export command, it is inconvient so set value automatically. I'm not such as old man(?) so I use the editor program, nano and create .bash_profile

nano ~/.bash_profile

JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk-18.0.2.1.jdk/Contents/Home"
ANDROID_HOME=/Users/{user_id}/Library/Android/sdk
export JAVA_HOME
export ANDROID_HOME
export PATH=$PATH:$ANDROID_HOME/platform-tools
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/bundle-tool

Set ANDROID_HOME, JAVA_HOME, platform-tools, tools, bundle-tool path.
And for launching automatically, add command to .zshrc file.
echo "source ~/.bash_profile" >> ~/.zshrc

gst-launch-1.0 and gst-inspect-1.0

Follow instruction as below link.
https://appium.io/docs/en/writing-running-appium/android/android-screen-streaming/

The install command via brew is as below.

brew install gstreamer gst-plugins-base gst-plugins-good gst-plugins-bad gst-plugins-ugly gst-libav
profile
QA Specialist

0개의 댓글