Original error: Error executing adbExec. error while starting app on phone through appium

Original error: Error executing adbExec. error while starting app on phone through appium

我使用:

如果我尝试在 phone 上通过 Appium 启动应用程序 - 出现错误:

An unknown server-side error occurred while processing the command. Original error: Cannot start the 'name' application. Visit https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/android/activity-startup.md for troubleshooting. Original error: Error executing adbExec. Original error: 'Command 'C:\pathtoadb\platform-tools\adb.exe -P 5037 -s 45678888 shell am start -W -n appname -S' timed out after 20000ms'. Try to increase the 20000ms adb execution timeout represented by 'adbExecTimeout' capability

我有真实 Pixel Android 设备的基本工作配置

{
  "automationName": "UiAutomator2",
  "platformName": "Android",
  "platformVersion": "8.1",
  "deviceName": "Pixel",
  "appPackage": "com.disney.wdw.android.debug",
  "appActivity": "com.disney.wdpro.park.activities.LoaderActivity",
  "udid": "<unique_identifier>
}

备注:

  1. 当您在 terminal/cmd.
  2. 上访问 adb devices 时,可以找到您的 UDID
  3. 您可以将 appPackage 和 appActivity 替换为 app 功能,其中指明您的 apk 所在的路径。
  4. deviceName 是必需的,但我相信 Appium 会在真实设备上忽略它。
  5. 我建议您使用最新版本的 Appium Desktop 或 CLI。
  6. 你可以使用默认的Appium for automationName作为你的自动化引擎,我的我用的是UIAutomator2,根据你的喜好调整。

有关功能使用的完整文档,请参阅 Appium 主站点。 http://appium.io/docs/en/writing-running-appium/caps/

如果您使用的是 UIAutomator2,那么您可以设置此功能“appWaitForLaunch : false”,默认情况下它设置为 true。

通过下载平台工具版本来降级您的 Android SDK,并将其替换为 android studio 中现有的平台 SDK。如果它不起作用,试试这个 -> 卸载你的 Android SDK 并重新安装它。

该错误背后的原因是开发人员选项没有适当的权限,或者我们必须禁用一些阻止应用程序安装到真实设备中的选项。

我们启用了这些选项:

  1. USB 调试。
  2. 通过 USB 安装。
  3. USB 调试(安全设置)。

在 MIUI 和 POCO 设备中进行上述设置后,需要禁用一些额外的设置才能消除此错误,即禁用以下选项:

  1. 通过 USB 验证应用程序。
  2. 验证可调试应用程序的字节码。