Original error: The JAVA_HOME environment variable must be set for Android Tools to work properly
My code:
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("BROWSER_NAME", "Android");
capabilities.setCapability("VERSION", "9.0");
// ZY224HFLPG is device name
capabilities.setCapability("deviceName","ZY224HFLPG");
capabilities.setCapability("platformName","Android");
capabilities.setCapability("appPackage", "com.android.calculator2");
capabilities.setCapability("appActivity","com.android.calculator2.Calculator");
driver = new RemoteWebDriver(new URL("http://127.0.0.1:4725/wd/hub"), capabilities);
Output:
org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Cannot verify the signature of 'C:UserskarakrisAppDataLocalProgramsAppium
esourcesapp
ode_modulesappium
ode_modulesappium-uiautomator2-serverapksappium-uiautomator2-server-v4.15.0.apk'.
Original error: The JAVA_HOME environment variable must be set for Android Tools to work properly
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'LIN19003760', ip: '192.168.0.106', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '15.0.1'
Driver info: driver.version: RemoteWebDriver
remote stacktrace: UnknownError: An unknown server-side error occurred while processing the command. Original error: Cannot verify the signature of 'C:UserskarakrisAppDataLocalProgramsAppium
esourcesapp
ode_modulesappium
ode_modulesappium-uiautomator2-serverapksappium-uiautomator2-server-v4.15.0.apk'. Original error: The JAVA_HOME environment variable must be set for Android Tools to work properly
at getResponseForW3CError (C:UserskarakrisAppDataLocalProgramsAppium
esourcesapp
ode_modulesappium
ode_modulesappium-base-driverlibprotocolerrors.js:804:9)
at asyncHandler (C:UserskarakrisAppDataLocalProgramsAppium
esourcesapp
ode_modulesappium
ode_modulesappium-base-driverlibprotocolprotocol.js:384:37)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:64)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
.
.
.
WHAT SHOULD HAVE TO DO?
question from:
https://stackoverflow.com/questions/65940426/in-eclipse-while-doing-appium-testing-how-to-set-java-home-environment-variab 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…