calabash-android does not launch the app in the emulator?

2,208 views
Skip to first unread message

Rodney Degracia

unread,
May 19, 2012, 9:57:18 PM5/19/12
to calabash-android

Greetings,

I have calabash-android 0.0.8 installed. calabash-android does not
launch the app in the emulator and I am wondering if there is
something I am doing wrong?

This is what I am doing:

# start the emulator
emulator -avd Google_API_Level_8 &

# clean and create debug builds
ant clean
ant debug

# build and run test server
calabash-android-build
calabash-android-run

Then I get the following:

2012-05-19 21:36:18 - Is first scenario - reinstalling apps
2012-05-19 21:36:18 - Uninstalling: com.my.app.test
2012-05-19 21:36:19 - Success
2012-05-19 21:36:19 - Uninstalling: com.my.app
2012-05-19 21:36:21 - Success
2012-05-19 21:36:21 - Installing: features/support/Test.apk
2207 KB/s (316360 bytes in 0.139s)
2012-05-19 21:36:25 - Success
2012-05-19 21:36:25 - Installing: /Users/NNN/Documents/Clients/AAA/
myapp/app/bin/myapp-debug.apk
2054 KB/s (442881 bytes in 0.210s)
2012-05-19 21:36:29 - Success
2012-05-19 21:36:29 - Starting test server using:
2012-05-19 21:36:29 - /Users/NNN/Documents/android/platform-tools/adb
shell am instrument -w -e class
sh.calaba.instrumentationbackend.InstrumentationBackend
com.my.app.test/android.test.InstrumentationTestRunner

junit.framework.TestSuite$1:
Test results for InstrumentationTestRunner=
2012-05-19 21:36:31 -
2012-05-19 21:36:31 - Got exception:end of file reached. Retrying!
Got exception:end of file reached. Retrying!
Got exception:end of file reached. Retrying!
Got exception:end of file reached. Retrying!
Got exception:end of file reached. Retrying!
2012-05-19 21:37:31 - Connection established
2012-05-19 21:37:31 - Action: press - Params: Login
2012-05-19 21:37:31 - Error communicating with test server: end of
file reached
When I press "Login" # features/
step_definitions/press_button_steps.rb:17
end of file reached (EOFError)
./features/support/hooks.rb:24:in `readline'
./features/support/hooks.rb:24:in `block in performAction'
/Users/rdegraci/.rvm/rubies/ruby-1.9.2-p318/lib/ruby/1.9.1/
timeout.rb:58:in `timeout'
./features/support/hooks.rb:21:in `performAction'
./features/step_definitions/press_button_steps.rb:18:in `/^I
press "([^\"]*)"$/'
features/login_dummy.feature:3:in `When I press "Login"'
Then I see "Enter your email and password to login!" # features/
step_definitions/assert_steps.rb:5
2012-05-19 21:37:31 - Closing connection to test






Jonas Maturana Larsen

unread,
May 20, 2012, 8:43:35 AM5/20/12
to calabash...@googlegroups.com
Hi Rodney,

It looks like your app is started but dies right away.
Have you had a look at the logcat output?

-- 
Jonas Maturana Larsen
Co-founder lesspainful.com
Phone: +45 40 16 75 77
Skype: jonasmaturana

rdeg...@gmail.com

unread,
May 20, 2012, 1:44:02 PM5/20/12
to calabash...@googlegroups.com
The log cat shows the App starting and stopping with no exceptions. I have tested calabash-android with another app and I get the same wierd behavior. 

My app is installed onto the emulator and launches with no problems manually so I am thinking the issue may be with calabash-android test server. During testing of calabash-android I tried to telnet to localhost port 7110 but was unable. So I am thinking that for some strange reason the test-server is not being started on the emulator via calabash-android

Do you have an simple test app and a set of step by step procedures that I can follow to verify that calabash-android really works? I would like to help debug this since there are at least two other people who have reported this behavior so far (searching google).


Rodney Degracia 

Sent from my iPhone

Jonas Maturana Larsen

unread,
May 20, 2012, 2:08:35 PM5/20/12
to calabash...@googlegroups.com
I'll get back to you tomorrow with a sample calabash project.
It is something we have wanted to do for a while.

Which OS are you running?

-- 
Jonas Maturana Larsen
Co-founder lesspainful.com
Phone: +45 40 16 75 77
Skype: jonasmaturana

Rodney Degracia

unread,
May 20, 2012, 2:38:11 PM5/20/12
to calabash...@googlegroups.com
Jonas,

Thanks for looking into this issue. I really appreciate your efforts with calabash-android.


I use Mac OSX Lion 10.7.4 (up to date as of May 20, 2012)


Just in case, here are the Andoid dev software and versions I have installed, as well:

rvm 1.12.5
ruby 1.9.2p318 (2012-02-14 revision 34678) [x86_64-darwin11.4.0]
calabash-android 0.10

Apache Ant(TM) version 1.8.2 compiled on June 3 2011
javac 1.6.0_31

Eclipse Java EE IDE for Web Developers.
Version: Indigo Service Release 2
Build id: 20120216-1857


Here is my environment rvm gemset gem list:

builder (3.0.0)
bundler (1.1.3)
calabash-android (0.0.10)
cucumber (1.2.0)
diff-lcs (1.1.3)
gherkin (2.10.0)
json (1.7.3)
rake (0.9.2.2)
rubygems-bundler (1.0.2)
rvm (1.11.3.3)
slowhandcuke (0.0.3)


If you need more information, just let me know and I'll send it to you asap.

Rodney

Jonas Maturana Larsen

unread,
May 21, 2012, 8:07:23 PM5/21/12
to calabash...@googlegroups.com
Hi Rodney,

Thanks for the detailed error report.

I have created a small demo app on GitHub with some instructions on how to set it up.
Could you give it a try?

Calabash should pass if your setup is working.

Thanks for helping out on this one!

- Jonas

-- 
Jonas Maturana Larsen
Co-founder lesspainful.com
Phone: +45 40 16 75 77
Skype: jonasmaturana

rdeg...@gmail.com

unread,
May 22, 2012, 11:19:02 AM5/22/12
to calabash...@googlegroups.com
Jonas,

Initial tests show that it works.  I think the initial problem was with me choosing Y for the keystore which I am guessing does something to make it not work. 



Btw I am using calabash-android as part of a continuous integration/delivery system. I did notice that after the cucumber completed the tests, I would have to manually hit the return key to end the calabash-run invocation; this may cause an issue with continuous integration/delivery systems since they would hang at that point since there is no way to hit return via the CI build script. 

I will follow up with a CI build script so we can verify. 

Rodney

Sent from my iPhone

Rodney Degracia

unread,
May 22, 2012, 1:05:20 PM5/22/12
to calabash...@googlegroups.com
Jonas,

Here is what I did to test this, if you can verify that my procedure
works, then perhaps you can include it along with the demo
documentation ?

# Prerequisites:
# Start with a clean workstation without Android Tools or Android installed
# Then download the Mac OSX Lion Android SDK into /usr/local/android-sdk-macosx
# And then download and install the Android 2.2 Level 8 SDK and AVDs


# Create the rvm workspace
rvm install ruby 1.9.2
rvm gemset create calabash-android-0.0.10
rvm gemset use calabash-android-0.0.10
gem install calabash-android -v 0.0.10

# list the virtual device targets
/usr/local/android-sdk-macosx/tools/android list targets

# create an android virtual device using Google API Level 8
# target #2 should be the Google Inc.:Google APIs:8 AVD
/usr/local/android-sdk-macosx/tools/android create avd -n
Google_API_Level_8 -t 2 -c 1000M

# clone the demo and change directory into it
git clone git://github.com/calabash/calabash-android-demoapp.git
cd calabash-android-demoapp

#create the ant build.xml and specify to target the AVD: Google API Level 8
/usr/local/android-sdk-macosx/tools/android/android update project
--target 2 --path .

#edit the build.xml and set the project name to "sh.calaba.demoproject"
vi build.xml

#build the debug project and verify the ppk is built
ant debug
ls -al bin/AndroidDemoProjectActivity-debug-unaligned.apk

# export the ANDROID_HOME env variable
export ANDROID_HOME=/usr/local/android-sdk-macosx

# generate the default features directory
calabash-android gen

# Run calabash-android setup and answer the questions:
# Package name: sh.calaba.demoproject
# Fully qualified name of main activity:
sh.calaba.demoproject.AndroidDemoProjectActivity
# Path to app: <fully qualified path to
calabash-android-demoapp>/bin/AndroidDemoProjectActivity-debug-unaligned.apk
# Api level: Pick 8
# When asked about specifying a keystore select: n
calabash-android setup


#build the test server
calabash-android build

#start the emulator into the background, using the AVD previously created above.
#once the emulator has launched, be sure to unlock it by sliding the
unlock button!
/usr/local/android-sdk-macosx/tools/emulator -avd Google_API_Level_8 &

#copy the demo app and test server to the avd and run the cucumber tests
#note: the cucumber test will fail because it is the default cucumber test
#but the app should install onto the AVD and it should run.
calabash-android run






Rodney

Jonas Maturana Larsen

unread,
May 22, 2012, 1:14:05 PM5/22/12
to calabash...@googlegroups.com
Did you fix it on your own project as well?

I just pushed calabash-android 0.0.11.
Could you check if that fixes your "press return"-problem?

-- 
Jonas Maturana Larsen
Co-founder lesspainful.com
Phone: +45 40 16 75 77
Skype: jonasmaturana

Jonas Maturana Larsen

unread,
May 22, 2012, 1:15:00 PM5/22/12
to calabash...@googlegroups.com
Cool!

I will cut out parts of it for the documentation.

-- 
Jonas Maturana Larsen
Co-founder lesspainful.com
Phone: +45 40 16 75 77
Skype: jonasmaturana

Rodney Degracia

unread,
May 22, 2012, 2:07:15 PM5/22/12
to calabash...@googlegroups.com

Jonas,

I did  gem install calabash-android and upgraded it to v 0.0.11 and the 'press return' problem is resolved.
I also verified using the procedure on my own project as well.


Thank you,

Rodney


Jonas Maturana Larsen

unread,
May 22, 2012, 2:08:51 PM5/22/12
to calabash...@googlegroups.com
Cool!

Then you can get to work on your own problems and not just ours ;)

-- 
Jonas Maturana Larsen
Co-founder lesspainful.com
Phone: +45 40 16 75 77
Skype: jonasmaturana

deepa habbu

unread,
May 14, 2013, 11:52:55 AM5/14/13
to calabash...@googlegroups.com


Hi

I am new to Calabash. I need some help. I have installed Ruby 1.9 and calabash .

I have followed the steps to resign the apk : calabash-android resign myapp.apk
then calabash-android build myapp.apk
signed the app and created testserver folder with some 4355e3.apk

I installed the 4355e3.apk on my device (which is displayed as instrumentation_backend on manage app folder under settings)

My query is how do I install the apk on my device using calabash and how to start the app

I tried the with the following steps
Feature: Launch app

  Scenario: I can start my app # features/launch_app.feature:4
    Given I start my app       # features/Step-definition/launch_app_steps.rb:1
      TODO (Cucumber::Pending)
      ./features/Step-definition/launch_app_steps.rb:2:in `/^I start my app$/'
      features/launch_app.feature:5:in `Given I start my app'
    Then I see "PCCW mobile"   # features/Step-definition/launch_app_steps.rb:5

1 scenario (1 pending)
2 steps (1 skipped, 1 pending)

can some one guide me
Message has been deleted

Bob Ansari

unread,
Jul 19, 2019, 9:17:16 AM7/19/19
to calabash-android
Hi,

I ran calabash with the latest version on Mac. It is working fine with Android API 23 but is broken when I tried API 28 and 29. I want to use Android Q with API 29.

What is it about Y keystore?

I could run the adb command:

`adb -s emulator-5554 shell am instrument -e with_uiautomator true -e main_activity null -e test_server_port 7102 -e class sh.calaba.instrumentationbackend.InstrumentationBackend com.intelex.mymobileapp.test/sh.calaba.instrumentationbackend.CalabashInstrumentationTestRunner`

But still could not connect to the test server with following error:

"It looks like your app is no longer running.
It could be because of a crash or because your test script shut it down.""

Thanks!
Reply all
Reply to author
Forward
0 new messages