IT虾米网

android之如何防止 calabash-android "App did not start"错误

third_qq_acbf90bbd2dede1d 2024年01月12日 编程语言 107 0

我在 linux 电脑上工作,

确保 AndroidManifest.xml 具有互联网权限。 尝试使用和不使用代理的命令,观察结果相同。

我的真实设备有4.1.1 android软件,

AVD 有 4.2.2 android 和 API 级别 17,这会是问题吗?

我观察到,示例演示应用程序在设备上启动,而我运行“calabash-android run AndroidDemoProject.apk... 但命令抛出错误,提示“应用程序未启动”(RunTimeError)。

错误详情:

Feature: Demo feature 
 
  Scenario: I can start my app                             # features/my_first.feature:3 
    I wait for "Hello World, AndroidDemoProject" to appear 
3707 KB/s (553745 bytes in 0.145s) 
3045 KB/s (36301 bytes in 0.011s) 
  App did not start (RuntimeError) 
  /usr/lib/ruby/gems/1.8/gems/calabash-android-0.4.9/lib/calabash-android/operations.rb:512:in `start_test_server_in_background' 
  /usr/lib/ruby/gems/1.8/gems/retriable-1.3.3.1/lib/retriable/retriable.rb:31:in `perform' 
  /usr/lib/ruby/gems/1.8/gems/retriable-1.3.3.1/lib/retriable/retriable.rb:59:in `retriable' 
  /usr/lib/ruby/gems/1.8/gems/calabash-android-0.4.9/lib/calabash-android/operations.rb:511:in `start_test_server_in_background' 
  /usr/lib/ruby/gems/1.8/gems/calabash-android-0.4.9/lib/calabash-android/operations.rb:92:in `start_test_server_in_background' 
  /home/vijayvk/Downloads/AndroidDemoProject/calabash/features/support/app_life_cycle_hooks.rb:15:in `Before' 
 
Failing Scenarios: 
cucumber features/my_first.feature:3 # Scenario: I can start my app 
I wait for "Hello World, AndroidDemoProject" to appear 
 
1 scenario (1 failed) 
0 steps 
0m22.337s 
=========================================================================== 
 
$calabash-android run ../AndroidDemoProject.apk --verbose, leads to below output 
 
013-09-04 15:42:45 - /usr/bin/ruby1.8 -S cucumber --verbose MAIN_ACTIVITY=sh.calaba.demoproject.AndroidDemoProjectActivity APP_PATH="/home/vijayvk/Downloads/AndroidDemoProject/AndroidDemoProject.apk" TEST_APP_PATH="test_servers/d06f94e698e2dfae7d59f229087ea78f_0.4.9.apk" 
Code: 
  * features/support/env.rb 
  * features/support/app_installation_hooks.rb 
  * features/support/app_life_cycle_hooks.rb 
  * features/support/hooks.rb 
  * features/step_definitions/calabash_steps.rb 
 
Features: 
  * features/my_first.feature 
Parsing feature files took 0m0.002s 
 
 
Feature: Demo feature 
 
  Scenario: I can start my app                             # features/my_first.feature:3 
    I wait for "Hello World, AndroidDemoProject" to appear 
2013-09-04 15:42:46 - First scenario in feature - reinstalling apps 
2013-09-04 15:42:46 - "/home/vijayvk/Development/adt-bundle-linux-x86-20130219/sdk/platform-tools/adb" -s 00000D6300009613 forward tcp:34777 tcp:7102 
2013-09-04 15:42:46 - 
2013-09-04 15:42:46 - Uninstalling: sh.calaba.demoproject.test 
2013-09-04 15:42:47 - Success 
2013-09-04 15:42:47 - Uninstalling: sh.calaba.demoproject 
2013-09-04 15:42:49 - Success 
2013-09-04 15:42:49 - Installing: test_servers/d06f94e698e2dfae7d59f229087ea78f_0.4.9.apk 
3153 KB/s (553745 bytes in 0.171s) 
2013-09-04 15:42:54 -     pkg: /data/local/tmp/d06f94e698e2dfae7d59f229087ea78f_0.4.9.apk 
Success 
2013-09-04 15:42:55 - Installing: /home/vijayvk/Downloads/AndroidDemoProject/AndroidDemoProject.apk 
4513 KB/s (36306 bytes in 0.007s) 
2013-09-04 15:42:56 -     pkg: /data/local/tmp/AndroidDemoProject.apk 
Success 
2013-09-04 15:42:59 - Waking up device using: 
2013-09-04 15:42:59 - "/home/vijayvk/Development/adt-bundle-linux-x86-20130219/sdk/platform-tools/adb" -s 00000D6300009613 shell am start -a android.intent.action.MAIN -n sh.calaba.demoproject.test/sh.calaba.instrumentationbackend.WakeUp 
Starting: Intent { act=android.intent.action.MAIN cmp=sh.calaba.demoproject.test/sh.calaba.instrumentationbackend.WakeUp } 
2013-09-04 15:43:01 - Starting test server using: 
2013-09-04 15:43:01 - "/home/vijayvk/Development/adt-bundle-linux-x86-20130219/sdk/platform-tools/adb" -s 00000D6300009613 shell am instrument -e class sh.calaba.instrumentationbackend.InstrumentationBackend -e target_package sh.calaba.demoproject -e test_server_port 7102 -e main_activity sh.calaba.demoproject.AndroidDemoProjectActivity -e debug false sh.calaba.demoproject.test/sh.calaba.instrumentationbackend.CalabashInstrumentationTestRunner 
 
  App did not start (RuntimeError) 
  /usr/lib/ruby/gems/1.8/gems/calabash-android-0.4.9/lib/calabash-android/operations.rb:512:in `start_test_server_in_background' 
  /usr/lib/ruby/gems/1.8/gems/retriable-1.3.3.1/lib/retriable/retriable.rb:31:in `perform' 
  /usr/lib/ruby/gems/1.8/gems/retriable-1.3.3.1/lib/retriable/retriable.rb:59:in `retriable' 
  /usr/lib/ruby/gems/1.8/gems/calabash-android-0.4.9/lib/calabash-android/operations.rb:511:in `start_test_server_in_background' 
  /usr/lib/ruby/gems/1.8/gems/calabash-android-0.4.9/lib/calabash-android/operations.rb:92:in `start_test_server_in_background' 
  /home/vijayvk/Downloads/AndroidDemoProject/calabash/features/support/app_life_cycle_hooks.rb:15:in `Before' 
 
Failing Scenarios: 
cucumber features/my_first.feature:3 # Scenario: I can start my app 
I wait for "Hello World, AndroidDemoProject" to appear 
 
1 scenario (1 failed) 
0 steps 
0m26.737s 
========================================================================== 
 
$ calabash-android console AndroidDemoProject/AndroidDemoProject.apk 
 
No test server found for this combination of app and calabash version. Recreating test server. 
Done signing the test server. Moved it to test_servers/d06f94e698e2dfae7d59f229087ea78f_0.4.9.apk 
 
irb(main):004:0> ARGV << "-v" 
[ 
    [0] "--readline", 
    [1] "--prompt-mode", 
    [2] "simple", 
    [3] "-v" 
] 
irb(main):005:0> start_test_server_in_background 
2013-09-04 16:29:06 - Starting test server using: 
2013-09-04 16:29:06 - "/home/vijayvk/Development/adt-bundle-linux-x86-20130219/sdk//platform-tools/adb" -s 00000D6300009613 shell am instrument -e test_server_port 7102 -e class sh.calaba.instrumentationbackend.InstrumentationBackend -e debug false -e target_package sh.calaba.demoproject -e main_activity sh.calaba.demoproject.AndroidDemoProjectActivity sh.calaba.demoproject.test/sh.calaba.instrumentationbackend.CalabashInstrumentationTestRunner 
RuntimeError: App did not start 
    from /usr/lib/ruby/gems/1.8/gems/calabash-android-0.4.9/lib/calabash-android/operations.rb:512:in `start_test_server_in_background' 
    from /usr/lib/ruby/gems/1.8/gems/retriable-1.3.3.1/lib/retriable/retriable.rb:31:in `perform' 
    from /usr/lib/ruby/gems/1.8/gems/retriable-1.3.3.1/lib/retriable/retriable.rb:59:in `retriable' 
    from /usr/lib/ruby/gems/1.8/gems/calabash-android-0.4.9/lib/calabash-android/operations.rb:511:in `start_test_server_in_background' 
    from /usr/lib/ruby/gems/1.8/gems/calabash-android-0.4.9/lib/calabash-android/operations.rb:92:in `start_test_server_in_background' 
    from (irb):5 

如果有解决此问题的方法,请告诉我...

请您参考如下方法:

当我遇到这个错误时,我可以通过这样做来解决这个问题:

1)关闭AVD并重启

2) 如果 (1) 没有解决问题,请卸载应用程序,然后再次为您的应用程序执行 reinstall_apps

3) 如果 (2) 没有解决问题,删除测试服务器文件夹并再次执行 start_test_server_in_background。


评论关闭
IT虾米网

微信公众号号:IT虾米 (左侧二维码扫一扫)欢迎添加!