maplee 发表于 2017-6-16 09:44:12

使用appium测试Android app遇到无法启动app的问题

各位大神,我在使用appium进行安卓app自动化测试的时候,遇到一个问题,
就是只有在手机重启之后的10~15分钟之内,app可以正常运行,
而超过这个时间,我无法再启动app,即使等很久,看起来好像是在手机端的appium.uiautomator2.server暂停运行了,所以没有相应?
这个时候,我只有重启手机,才能恢复正常,但是同样,超过10~15分钟,又无法连接了,各位大神有遇到这种情况,或者给点帮助的么?

无法连接的时候,ADB log 如下:

Starting uiautomator2 server v0.1.5 with cmd: am,instrument,-w,io.appium.uiautomator2.server.test/android.support.test.runner.AndroidJUnitRunner
running command...
adb -s 33c535c8 shell am instrument -w io.appium.uiautomator2.server.test/android.support.test.runner.AndroidJUnitRunner...
Waiting up to 20000ms for UiAutomator2 to be online...
Proxying to with no body
Proxying to with no body
Proxying to with no body
Proxying to with no body
Proxying to with no body
Proxying to with no body
Proxying to with no body
Proxying to with no body
Proxying to with no body
Proxying to with no body
Proxying to with no body
Proxying to with no body
Proxying to with no body
Proxying to with no body
Proxying to with no body
Proxying to with no body
Proxying to with no body
Proxying to with no body
Proxying to with no body
Proxying to with no body
Deleting UiAutomator2 session
Deleting UiAutomator2 server session
Did not get confirmation UiAutomator2 deleteSession worked; Error was: Error: Trying to proxy a session command without session id
Getting connected devices...
1 device(s) connected
Running 'C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","33c535c8","shell","am","force-stop","com.dashang.tiangou"]
Stopping logcat capture
Removing forwarded port socket connection: 8200
Running 'C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","33c535c8","forward","--remove","tcp:8200"]
Encountered internal error running command: ProxyRequestError: Could not proxy command to remote server. Original error: Error: read ECONNRESET
    at JWProxy.proxy$ (../../../lib/jsonwp-proxy/proxy.js:153:13)
    at tryCatch (C:\Program Files\nodejs\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:67:40)
    at GeneratorFunctionPrototype.invoke (C:\Program Files\nodejs\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:315:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) (C:\Program Files\nodejs\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:100:21)
    at GeneratorFunctionPrototype.invoke (C:\Program Files\nodejs\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:136:37)



我的系统环境如下:

Appium Version : 1.6.5
Java-Client: 5.0.0-BETA5
Selenium-java:3.4.0
JDK: jdk1.8.0_112
Android: 6.0.1

代码配置如下:

       DesiredCapabilities capabilities = new DesiredCapabilities();

      capabilities.setCapability("deviceName", appDeviceName);
      capabilities.setCapability("platformVersion", appPlatFormVersion);
      capabilities.setCapability("app", apk.getAbsolutePath());
      capabilities.setCapability("appActivity", activityName);
      capabilities.setCapability("platformName", "android");
      capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, AutomationName.ANDROID_UIAUTOMATOR2);
      capabilities.setCapability(AndroidMobileCapabilityType.APP_WAIT_ACTIVITY, "com.dashang.*");
      capabilities.setCapability("autoGrantPermissions", "true");

      driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);

jingzizx 发表于 2017-6-17 09:58:20

帮顶

finismundi 发表于 2017-10-4 17:15:06

我也遇到了这个问题,请问楼主解决了没呀
页: [1]
查看完整版本: 使用appium测试Android app遇到无法启动app的问题