我正在尝试运行 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
异常屏幕截图
我通过使用 gradle 任务运行构建来解决问题:app:assembleDebug在上面的异常中,Calabash 找不到包名称,因为它在另一个 DEX 类上。我认为在葫芦中,他们可能在multidex项目方面遇到问题,Android Studio将始终为您的应用程序启用multidex,即使它不需要它。我不是专家,欢迎任何建议,希望有些人能从这个答案中受益。