【问题标题】:Appium: custom android app keeps crashing on launchAppium:自定义 android 应用程序在启动时不断崩溃
【发布时间】:2018-08-02 06:22:40
【问题描述】:

遇到一个问题,以前工作的基于 appium 的 Android 应用 selenium 测试突然停止工作(一直成功)。

这个问题与 appium 启动应用程序有关(应用程序总是在使用物理用户输入打开时启动......)。基本上应用程序启动,加载屏幕出现,然后崩溃。大多数情况下都会发生这种情况,但并非总是如此。我发现它通常在重新启动手机后最初可以正常工作。但是,它会在后续运行时崩溃。

任何帮助将不胜感激。已经尝试了很多东西/在网上搜索,但都无济于事..

这是 appium 的输出:

[AndroidDriver] Parsed pid: '27608' pkg: 'com.dedsert.betbright.uat' from
[AndroidDriver]     USER      PID   PPID  VSIZE  RSS   WCHAN              PC  NAME
[AndroidDriver]     u0_a236   27608 4736  3621124 393160          0 0000000000 R com.dedsert.betbright.uat
[AndroidDriver] Returning process name: 'com.dedsert.betbright.uat'
[AndroidDriver] Found webviews: ["WEBVIEW_com.dedsert.betbright.uat"]
[AndroidDriver] Available contexts: ["NATIVE_APP","WEBVIEW_com.dedsert.betbright.uat"]
[MJSONWP] Responding to client with driver.setContext() result: null
[HTTP] <-- POST /wd/hub/session/a9457315-d657-4fd1-bdf0-36fe5d76b3c5/context 200 245 ms - 76 
[AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_RESULT: shortMsg=java.lang.StackOverflowError
[AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_RESULT: longMsg=stack size 1037KB
[AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_CODE: 0
[UiAutomator] UiAutomator exited unexpectedly with code 4294967295, signal null
[UiAutomator] Moving to state 'stopped'
[AndroidDriver] Shutting down Android driver
[Appium] Closing session, cause was 'UiAUtomator shut down unexpectedly'
[Appium] Removing session a9457315-d657-4fd1-bdf0-36fe5d76b3c5 from our master session list
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Users\kroring\AppData\Local\Android\Sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","ce051715c336451002","shell","am","force-stop","com.dedsert.betbright.uat"]
[ADB] Pressing the HOME button
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Users\kroring\AppData\Local\Android\Sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","ce051715c336451002","shell","input","keyevent",3]
[AndroidBootstrap] Cannot shut down Android bootstrap; it has already shut down
[Logcat] Stopping logcat capture
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Users\kroring\AppData\Local\Android\Sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","ce051715c336451002","shell","am","force-stop","io.appium.unlock"]
[AndroidDriver] Not cleaning generated files. Add `clearSystemFiles` capability if wanted.
[HTTP] --> POST /wd/hub/session/a9457315-d657-4fd1-bdf0-36fe5d76b3c5/context {"name":"WEBVIEW_com.dedsert.betbright.uat"}
[HTTP] <-- POST /wd/hub/session/a9457315-d657-4fd1-bdf0-36fe5d76b3c5/context 404 1 ms - 131 

在 IntelliJ 方面看不到很多东西 - 确实在给定的堆栈跟踪中发现了这一点:

org.openqa.selenium.remote.SessionNotFoundException: A session is either terminated or not started (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 5 milliseconds

【问题讨论】:

  • shortMsg=java.lang.StackOverflowError 看起来某个进程内存不足。这可能表明其中一个程序存在内存泄漏,但由于您的设置信息和知识有限,很难判断。手机上是否有很多应用/通知/服务/后台进程在运行?

标签: java android selenium appium


【解决方案1】:

您的手机似乎内存不足。清除测试手机的缓存可能是值得的:

  • 关闭您的设备。这种方法因人而异 厂家,你应该先上网查一下 进一步进行。
  • 按住 加载到引导加载程序屏幕 组合键。在某些设备中,您必须按电源 按钮与降低音量键同时进行。在其他设备中,电源 必须同时按下两个音量键的按钮。 触摸屏可能无法使用,您必须使用音量导航 键。
  • 转到恢复并点击电源按钮将其选中。
  • 进入擦除缓存分区并点击电源按钮将其选中。
  • 缓存清除后,选择立即重启系统。

来自(第 4 步)的信息:https://fossbytes.com/clear-android-cache-data-quick-methods/

【讨论】:

    【解决方案2】:

    卸载appium并重新安装appium,它会为你工作。 从命令行。

    npm uninstall -g appium
    

    重新安装appium。

    npm install -g appium
    

    【讨论】:

      猜你喜欢
      • 2016-04-08
      • 2017-10-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多