calabash-android 运行 app-debug.apk 抛出异常

calabash-android run app-debug.apk throws exception

我正在尝试 运行 calabash-android 来测试我的应用程序,但出现以下错误,在我尝试进行一些修改之前,未经任何修改的同一个应用程序正在运行,但是然后我恢复了对应用程序的所有修改:

Exception occurred while dumping:
java.lang.IllegalArgumentException: Unknown package: com.bitbar.testdroid
    at com.android.server.pm.Settings.isOrphaned(Settings.java:4134)
    at com.android.server.pm.PackageManagerService.isOrphaned(PackageManagerService.java:18091)
    at com.android.server.pm.PackageManagerService.deletePackage(PackageManagerService.java:15508)
    at com.android.server.pm.PackageInstallerService.uninstall(PackageInstallerService.java:888)
    at com.android.server.pm.PackageManagerShellCommand.runUninstall(PackageManagerShellCommand.java:792)
    at com.android.server.pm.PackageManagerShellCommand.onCommand(PackageManagerShellCommand.java:118)
    at android.os.ShellCommand.exec(ShellCommand.java:94)
    at com.android.server.pm.PackageManagerService.onShellCommand(PackageManagerService.java:18349)
    at android.os.Binder.shellCommand(Binder.java:468)
    at android.os.Binder.onTransact(Binder.java:367)
    at android.content.pm.IPackageManager$Stub.onTransact(IPackageManager.java:2387)
    at com.android.server.pm.PackageManagerService.onTransact(PackageManagerService.java:3031)
    at android.os.Binder.execTransact(Binder.java:565)

然后

Success
Success
  Scenario: I can choose a file from the Gallery # features/my_first.feature:3
  HTTPClient::KeepAliveDisconnected: Connection reset by peer @ io_fillbuf - fd:8  (HTTPClient::KeepAliveDisconnected)
  ./features/support/app_life_cycle_hooks.rb:5:in `Before'
    When I take a screenshot                     # calabash-android-0.9.0/lib/calabash-android/steps/screenshot_steps.rb:9
    Then I take a screenshot                     # calabash-android-0.9.0/lib/calabash-android/steps/screenshot_steps.rb:9

Failing Scenarios:
cucumber features/my_first.feature:3 # Scenario: I can choose a file from the Gallery

1 scenario (1 failed)
2 steps (2 skipped)
0m6.240s

Exception ScreenShot

我通过 运行 使用 gradle 任务构建解决了这个问题 :app:assembleDebug 在上面的异常中,calabash 找不到包名,因为它在另一个 dex class 上。 我认为在 calabash 中,他们可能会遇到 multidex 项目的问题,并且 Android Studio 将始终为您的应用程序启用 multidex,即使它不需要它。 我不是专家,欢迎大家提出建议,希望这个回答可以让一些人受益。