Could not start Appium programmatically using apple M1 proc.
See original GitHub issueThe problem
Could not start Appium programmatically using apple M1 proc.
lmihai@192-168-0-113 ~ % echo $SHELL
/bin/zsh
lmihai@192-168-0-113 ~ % echo $ANDROID_HOME
/Users/lmihai/Library/Android/sdk
lmihai@192-168-0-113 ~ % env | grep ANDROID_HOME
ANDROID_HOME=/Users/lmihai/Library/Android/sdk
lmihai@192-168-0-113 ~ %
Environment
- Appium version (or git revision) that exhibits the issue: Appium v1.22.0-beta.0
- Desktop OS/version used to run Appium: macOS Big Sur 11.3.1
- Node.js version (unless using Appium.app|exe): v15.13.0
- Npm or Yarn package manager: 7.8.0
- Mobile platform/version under test: Android (Pixel 2, Android 11)
- Real device or emulator/simulator: Pixel 2, Android 11
Details
Neither ANDROID_HOME nor ANDROID_SDK_ROOT environment variable was exported when trying to run tests programmatically
Link to Appium logs
https://gist.github.com/vjmaiky/540f14f4bcfa39ee9764eb375f143505
appium-doctor seems to be ok:
info AppiumDoctor Appium Doctor v.1.16.0
info AppiumDoctor ### Diagnostic for necessary dependencies starting ###
info AppiumDoctor ✔ The Node.js binary was found at: /opt/homebrew/bin/node
info AppiumDoctor ✔ Node version is 15.13.0
info AppiumDoctor ✔ Xcode is installed at: /Applications/Xcode.app/Contents/Developer
info AppiumDoctor ✔ Xcode Command Line Tools are installed in: /Applications/Xcode.app/Contents/Developer
info AppiumDoctor ✔ DevToolsSecurity is enabled.
info AppiumDoctor ✔ The Authorization DB is set up properly.
info AppiumDoctor ✔ Carthage was found at: /opt/homebrew/bin/carthage. Installed version is: 0.38.0
info AppiumDoctor ✔ HOME is set to: /Users/lmihai
info AppiumDoctor ✔ ANDROID_HOME is set to: /Users/lmihai/Library/Android/sdk
info AppiumDoctor ✔ JAVA_HOME is set to: /Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home
info AppiumDoctor Checking adb, android, emulator
info AppiumDoctor 'adb' is in /Users/lmihai/Library/Android/sdk/platform-tools/adb
info AppiumDoctor 'android' is in /Users/lmihai/Library/Android/sdk/tools/android
info AppiumDoctor 'emulator' is in /Users/lmihai/Library/Android/sdk/emulator/emulator
info AppiumDoctor ✔ adb, android, emulator exist: /Users/lmihai/Library/Android/sdk
info AppiumDoctor ✔ 'bin' subfolder exists under '/Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home'
Using grep i can see that i have a process in place:
lmihai@192-168-0-113 ~ % ps -A | grep appium
3327 ?? 0:00.96 /opt/homebrew/Cellar/node/15.13.0/bin/node /opt/homebrew/lib/node_modules/appium/build/lib/main.js --port 5138 --address 127.0.0.1 --log-level debug --robot-address HT8281A03687 --chromedriver-port 9537 --bootstrap-port 4777 --relaxed-security --default-capabilities {"app":"/Users/lmihai/Downloads/app.apk","appActivity":"","appPackage":"","automationName":"uiautomator2","deviceName":"HT8281A03687","newCommandTimeout":600,"noReset":false,"platformName":"android","systemPort":8204,"udid":"HT8281A03687","unicodeKeyboard":true}
3337 ttys000 0:00.00 grep appium
Code To Reproduce Issue [ Good To Have ]
service creation
private static AppiumDriverLocalService createService(Scenario scenario) throws Exception {
service = AppiumDriverLocalService
.buildService(new AppiumServiceBuilder()
.usingDriverExecutable(new File(getAndroidJasonResults().getNodeJS()))
.withAppiumJS(new File(getAndroidJasonResults().getAppiumJS()))
.withIPAddress(getAndroidJasonResults().getIp())
// .usingAnyFreePort()
.usingPort(getAndroidJasonResults().getAppiumServerPort())
.withArgument(GeneralServerFlag.ROBOT_ADDRESS, getAndroidJasonResults().getDeviceID())
.withArgument(AndroidServerFlag.BOOTSTRAP_PORT_NUMBER,
getAndroidJasonResults().getBootstratPort())
.withArgument(AndroidServerFlag.CHROME_DRIVER_PORT, getAndroidJasonResults().getChromePort())
.withArgument(Arg.LOG_LEVEL, getAndroidJasonResults().getLogLevel())
.withArgument(GeneralServerFlag.RELAXED_SECURITY)
.withStartUpTimeOut(120, TimeUnit.SECONDS)
.withCapabilities(getCaps(scenario)));
MyLogger.log.info("+++++++++++++++++++++++ STARTING APPIUM SERVER ++++++++++++++++++++++");
MyLogger.log.info(String.format(
"Appium server running for device with UDID: " + getAndroidJasonResults().getDeviceID() + " using bootstrap port: " + getAndroidJasonResults().getBootstratPort() + " and chromedriverport: " +
getAndroidJasonResults().getChromePort()));
MyLogger.log.info("++++++++++++++++++ STARTED APPIUM SERVER ++++++++++++++++++: " + service.getUrl());
return service;
}
Issue Analytics
- State:
- Created 2 years ago
- Comments:10
Top Results From Across the Web
Mac M1 - Unable to programmatically launch Appium using ...
Try to check your setup with github.com/appium/appium-doctor . If everything is fine, please share your code that throws an error. – Max ...
Read more >Appium IOS tests running when server started manually but ...
However, when I attempt to start the appium server programmatically, the application under test fails to launch, with the following error:
Read more >Apple Developer Forums
Post your questions, exchange knowledge, and connect with fellow developers and Apple engineers on a variety of software development topics. For questions about ......
Read more >How to Install Oracle Instant Client on Apple Silicon M1
Step 1: install rosetta2. Use below command to install rosetta2: /usr/sbin/softwareupdate — install-rosetta. Note: The above command will launch the ...
Read more >neither android_home nor android_sdk_root environment ...
The problem. Could not start Appium programmatically using apple M1 proc. lmihai@192-168-0-113 ~ % echo $SHELL /bin ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
thank you; now works
.withEnvironment(env)
This should not be in PATH, but rather a separate variable