这几天在mac上安装Android appium环境,因为之前做完了iOS UI自动化任务,这次只需要安装一下Android需要的驱动和插件就行。

使用appium-doctor --android检查一下:

testmanzhang@TestMandeMBP sdk % appium-doctor --android
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 ###
(node:15938) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
info AppiumDoctor  ✔ The Node.js binary was found at: /usr/local/bin/node
info AppiumDoctor  ✔ Node version is 23.1.0
info AppiumDoctor  ✔ ANDROID_HOME is set to: /Users/testmanzhang/Library/Android/sdk
info AppiumDoctor  ✔ JAVA_HOME is set to: /Library/Java/JavaVirtualMachines/jdk-1.8.jdk/Contents/Home
info AppiumDoctor    Checking adb, android, emulator, apkanalyzer
info AppiumDoctor      'adb' is in /Users/testmanzhang/Library/Android/sdk/platform-tools/adb
info AppiumDoctor      'emulator' is in /Users/testmanzhang/Library/Android/sdk/emulator/emulator
WARN AppiumDoctor  ✖ android, apkanalyzer could NOT be found in /Users/testmanzhang/Library/Android/sdk!
info AppiumDoctor  ✔ 'bin' subfolder exists under '/Library/Java/JavaVirtualMachines/jdk-1.8.jdk/Contents/Home'
info AppiumDoctor ### Diagnostic for necessary dependencies completed, one fix needed. ###
info AppiumDoctor 
info AppiumDoctor ### Diagnostic for optional dependencies starting ###
info AppiumDoctor  ✔ opencv4nodejs is installed at: /usr/local/lib. Installed version is: 5.6.0
info AppiumDoctor  ✔ ffmpeg is installed at: /usr/local/bin/ffmpeg. ffmpeg version 7.1 Copyright (c) 2000-2024 the FFmpeg developers
info AppiumDoctor  ✔ mjpeg-consumer is installed at: /usr/local/lib. Installed version is: 2.0.0
WARN AppiumDoctor  ✖ bundletool.jar cannot be found
WARN AppiumDoctor  ✖ gst-launch-1.0 and/or gst-inspect-1.0 cannot be found
info AppiumDoctor ### Diagnostic for optional dependencies completed, 2 fixes possible. ###
info AppiumDoctor 
info AppiumDoctor ### Manual Fixes Needed ###
info AppiumDoctor The configuration cannot be automatically fixed, please do the following first:
WARN AppiumDoctor  ➜ Manually install android, apkanalyzer and add it to PATH. https://developer.android.com/studio#cmdline-tools and https://developer.android.com/studio/intro/update#sdk-manager may help to setup.
info AppiumDoctor 
info AppiumDoctor ### Optional Manual Fixes ###
info AppiumDoctor The configuration can install optionally. Please do the following manually:
WARN AppiumDoctor  ➜ bundletool.jar is used to handle Android App Bundle. Please read http://appium.io/docs/en/writing-running-appium/android/android-appbundle/ to install it
WARN AppiumDoctor  ➜ gst-launch-1.0 and gst-inspect-1.0 are used to stream the screen of the device under test. Please read https://appium.io/docs/en/writing-running-appium/android/android-screen-streaming/ to install them and for more details
info AppiumDoctor 
info AppiumDoctor ###
info AppiumDoctor 
info AppiumDoctor Bye! Run appium-doctor again when all manual fixes have been applied!
info AppiumDoctor 

apkanalyzer没有安装,首先说一下apkanalyzer的作用:通过 APK 分析器的命令行版本,可以在构建流程完成后立即了解 APK 的组成,并且可以比较两个 APK 之间的差异。使用 APK 分析器可以减少调试应用中的 DEX 文件和资源相关问题所花费的时间,并减小 APK 的大小。这是来自官方Android SDK Tools(https://developer.android.com/tools/apkanalyzer?hl=zh-cn)的说明。

这里要说的是,apkanalyzer的位置发生变化了,按照官方文档的最新介绍,apkanalyzer 包含在 Android SDK 命令行工具软件包中(位于 android_sdk/cmdline-tools/version/bin/apkanalyzer)。

这样的话只需要把这个路径添加到配置文件中即可:

export ANDROID_HOME=/Users/testmanzhang/Library/Android/sdk
export PATH=$ANDROID_HOME/emulator:$ANDROID_HOME/tools:$ANDROID_HOME/tools/bin:$ANDROID_HOME/platform-tools:$ANDROID_HOME/cmdline-tools/latest/bin:$ANDROID_HOME$

Logo

北京人形旗下天工造物具身智能开源社区,聚焦具身天工与慧思开物两大平台

更多推荐