我在真实的Android设备上运行脚本时编写了appium脚本。我面临 500 错误
`导入 io.appium.java_client.android.AndroidDriver; 导入 org.openqa.selenium.remote.DesiredCapability; 导入java.net.URL;
公共类 hyerTest1 {
static AndroidDriver driver;
public static void main(String[] args) throws Exception {
// Set desired capabilities for the Android device and the app to be tested
DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability("platformName", "Android");
cap.setCapability("automationName", "UiAutomator2");
cap.setCapability("udid", "R5CRA1VFJAE"); // Device ID of the Android device
cap.setCapability("deviceName", "galaxy S21 5G"); // Name of the Android device
cap.setCapability("appPackage", "io.appium.android.apis"); // Package name of the app
cap.setCapability("appActivity", "io.appium.android.apis.ApiDemos"); // Activity name of the app
cap.setCapability("noReset","True");
// Specify the URL of the Appium server
URL url = new URL("http://127.0.0.1:4723/wd/hub/");
// Initialize the AndroidDriver with the specified capabilities and URL
driver = new AndroidDriver(url, cap);
// Print message to indicate that the application has started
System.out.println("Application started!!!");
}
} ` 我发现错误:线程“main”org.openqa.selenium.SessionNotCreatedException 中出现异常:无法启动新会话。响应代码 500。消息:处理命令时发生未知的服务器端错误。原始错误:zipAlignApk 失败。原始错误:命令 ''C:\Users\Safiqur Rahman\AppData\Local\Android\Sdk uild-tools .0.0-rc3\zipalign.exe' -f 4 'C:\Users\Safiqur Rahman\AppData\Local \程序\Appium 资源页 ode_modules ppium ode_modules ppium-uiautomator2-server pks ppium-uiautomator2-server-v1.18.0.apk' C:\Users\SAFIQU~1\AppData\Local\Temp�4328-9312-mpnq88.qs6m ppium.tmp' 已退出代码为 1。标准输出:''; Stderr:'无法打开'C:\ Users \ Safiqur Rahman \ AppData \ Local \ Programs \ Appium 资源页 ode_modules ppium ode_modules ppium-uiautomator2-server pks ppium-uiautomator2-server-v1.18.0.apk' 作为 zip 存档:没有错误 '
尝试一下,