Java 无法在android real设备上启动应用程序,appium服务器将自动关闭

Java 无法在android real设备上启动应用程序,appium服务器将自动关闭,java,selenium,selenium-webdriver,appium,appium-android,Java,Selenium,Selenium Webdriver,Appium,Appium Android,设置以下所需功能后,仍然无法启动应用程序,仍然在控制台“线程中的异常”main“org.openqa.selenium.WebDriverException”上出错:无法创建新会话,因为找不到使用HttpClient、InputStream和long的“createSession”或无法访问它 但是,无法获取appium服务器日志,因为获取此错误appium服务器将自动关闭: 我在执行过程中为appium服务器日志捕获了视频,请查找该视频的屏幕广播: 重现问题的代码[很好] 公共类启动应用程序{

设置以下所需功能后,仍然无法启动应用程序,仍然在控制台“线程中的异常”main“org.openqa.selenium.WebDriverException”上出错:无法创建新会话,因为找不到使用HttpClient、InputStream和long的“createSession”或无法访问它 但是,无法获取appium服务器日志,因为获取此错误appium服务器将自动关闭: 我在执行过程中为appium服务器日志捕获了视频,请查找该视频的屏幕广播:

重现问题的代码[很好]
公共类启动应用程序{
机器人驱动;
@课前
public void beforeClass()引发畸形的DurException、InterruptedException{
DesiredCapabilities=新DesiredCapabilities();
capab.setCapability(“deviceName”、“Redmi注释5”);
capab.setCapability(“udid”、“35924c6f0804”);
capab.setCapability(“平台名”、“安卓”);
capab.setCapability(“平台版”、“8.1.0”);
capab.setCapability(“appPackage”、“com.miui.calculator”);
capab.setCapability(“appActivity”、“com.miui.calculator.cal.CalculatorActivity”);
驱动程序=新的AndroidDriver(新的URL(“http://0.0.0.0:4723/wd/hub"(投诉警察课),;
   
睡眠(5000);
}
@试验
public void m1()引发InterruptedException{
系统输出打印项次(“kfd”);
《睡眠》(2000年);
   
}
}
Ecxeption堆栈跟踪
控制台异常:
org.openqa.selenium.WebDriverException:无法创建新会话,因为找不到使用HttpClient、InputStream和long的“createSession”,或者无法访问该会话
构建信息:版本:'3.14.0',修订版:'aacccce0',时间:'2018-08-02T20:19:58.91Z'
系统信息:主机:'OFFICE-PC',ip:'--,'--',os.name:'Windows 7',os.arch:'amd64',os.version:'6.1',java.version:'1.8.0_152-release'
驱动程序信息:Driver.version:AndroidDriver
位于io.appium.java_client.remote.AppiumCommandExecutor$1.createSession(AppiumCommandExecutor.java:195)
位于io.appium.java_client.remote.AppiumCommandExecutor.createSession(AppiumCommandExecutor.java:209)
在io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:231)
位于org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:548)
在io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:42)
在io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
位于io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)
位于org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:212)
位于org.openqa.selenium.remote.RemoteWebDriver。(RemoteWebDriver.java:130)
位于io.appium.java_client.DefaultGenericMobileDriver。(DefaultGenericMobileDriver.java:38)
位于io.appium.java_client.AppiumDriver。(AppiumDriver.java:84)
位于io.appium.java_client.AppiumDriver。(AppiumDriver.java:94)
位于io.appium.java_client.android.AndroidDriver.(AndroidDriver.java:93)
位于com.example.office.appium_project.launchApp.beforeClass(launchApp.java:38)
在sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)处
位于sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
在sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)中
位于java.lang.reflect.Method.invoke(Method.java:498)
位于org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:124)
位于org.testng.internal.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:59)
位于org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:458)
位于org.testng.internal.Invoker.invokeConfigulations(Invoker.java:222)
位于org.testng.internal.Invoker.invokeMethod(Invoker.java:523)
位于org.testng.internal.Invoker.invokeTestMethod(Invoker.java:719)
位于org.testng.internal.Invoker.invokeTestMethods(Invoker.java:989)
位于org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
位于org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
位于org.testng.TestRunner.privateRun(TestRunner.java:648)

您能试用一下selenium 2.53版吗?您在开始时声明selenium是3.12.0,但错误日志显示它是3.14.0。这不一定是你的问题,但你应该意识到。如果我在这一点上进行猜测(这将是一个猜测),我会尝试不使用WebElement,而是使用MobileElement或AndroidElement,也就是说,
AndroidDriver
@Amit Jain#Bill Hileman,我已经将WebElement更新为AndroidElement,并尝试了所有版本的selenium jar,但无法在移动设备上启动应用程序。请建议使用含硒的appium的稳定版本,以便我可以解决我的问题。您是否尝试过以下依赖项<代码>org.seleniumhq.selenium selenium java 2.53.0我也尝试过使用selenium 2.53.0,但仍然出现同样的错误,无法打开应用程序…您能推荐稳定版本的Appium和selenium吗?
**Environment** 
- java client build version : 6.1.0 
- Appium server version : 1.7.1 
- Desktop OS/version used to run Appium if necessary: Windows 7 
- Node.js version : 6.4.1 
- Mobile platform/version under test: Android/ 8.1.0 
- Real device or emulator/simulator: Real device 
- Selenium Version: 3.12.0
- TestNg Version : 6.14.3 
 Code To Reproduce Issue [ Good To Have ] 
public class launchApp {
AndroidDriver<WebElement> driver;

@BeforeClass
public void beforeClass() throws MalformedURLException, InterruptedException {
    DesiredCapabilities capab = new DesiredCapabilities();

    capab.setCapability("deviceName", "Redmi Note 5");
    capab.setCapability("udid", "35924c6f0804");
    capab.setCapability("platformName", "Android");
    capab.setCapability("platformVersion", "8.1.0");
    capab.setCapability("appPackage", "com.miui.calculator");
    capab.setCapability("appActivity", "com.miui.calculator.cal.CalculatorActivity");
    driver = new AndroidDriver<WebElement>(new URL("http://0.0.0.0:4723/wd/hub"), capab);
   
     Thread.sleep(5000);
}

@Test
public void m1() throws InterruptedException {
    System.out.println("kfd");
    Thread.sleep(2000);
   
}
}




Ecxeption stacktraces 
Console Exception:
org.openqa.selenium.WebDriverException: It is impossible to create a new session because 'createSession' which takes HttpClient, InputStream and long was not found or it is not accessible
Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:19:58.91Z'
System info: host: 'OFFICE-PC', ip: '---.---,---', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_152-release'
Driver info: driver.version: AndroidDriver
at io.appium.java_client.remote.AppiumCommandExecutor$1.createSession(AppiumCommandExecutor.java:195)
at io.appium.java_client.remote.AppiumCommandExecutor.createSession(AppiumCommandExecutor.java:209)
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:231)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:548)
at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:42)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:212)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:130)
at io.appium.java_client.DefaultGenericMobileDriver.<init>(DefaultGenericMobileDriver.java:38)
at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:84)
at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:94)
at io.appium.java_client.android.AndroidDriver.<init>(AndroidDriver.java:93)
at com.example.office.appium_project.launchApp.beforeClass(launchApp.java:38)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:124)
at org.testng.internal.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:59)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:458)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:222)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:523)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:719)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:989)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
at org.testng.TestRunner.privateRun(TestRunner.java:648)