calabash / field-service-example

Xamarin Field Service sample used at Evolve
4 stars 6 forks source link

Not able to run Calabash test with Xamrin Project #1

Closed saikrishna321 closed 9 years ago

saikrishna321 commented 11 years ago

I resigned the apk file which was found in the project

Ran the below command to execute the tests calabash-android run FieldService.Android/FieldService.Android.apk -p android features/login.feature

Got the below problem

Scenario: Login with valid user # features\login.feature:3 Initial app and test-server install2540 KB/s (3965110 bytes in 1.524s) 260 KB/s (528784 bytes in 1.983s) App did not start (RuntimeError) C:/Ruby193/lib/ruby/gems/1.9.1/gems/calabash-android-0.4.6/lib/calabash-androi d/operations.rb:390:in block in start_test_server_in_background' C:/Ruby193/lib/ruby/gems/1.9.1/gems/retriable-1.3.3/lib/retriable/retriable.rb :31:inperform' C:/Ruby193/lib/ruby/gems/1.9.1/gems/retriable-1.3.3/lib/retriable/retriable.rb :50:in `retriable'

When i manually open the apk on device after the resign , it doesnt launch rather just a blank screen is seen

For details please refer the link

https://groups.google.com/forum/?fromgroups#!topic/calabash-android/R8ZF763kIto

krukow commented 11 years ago

There is a bug in the resign code which causes resign to fail on Xamarin Android apps. On OSX this can be resolved by resigning using an alternative method. On windows we don't have a fix the moment - we're looking into this.

OSX fix : resign.sh

#!/bin/bash
tmp_resign_apk_path="/tmp/tmp_path_for_resigned.apk"
echo $tmp_resign_apk_path
rm $tmp_resign_apk_path
zip $1 -d "META-INF/*"
jarsigner -keystore ~/.android/debug.keystore -storepass android -keypass android $1 androiddebugkey
$ANDROID_HOME/tools/zipalign 4 $1 $tmp_resign_apk_path
mv $tmp_resign_apk_path $1
krukow commented 11 years ago

see also: http://dnlkntt.wordpress.com/2011/11/29/how-to-resign-a-android-apk-file-for-testing/

saikrishna321 commented 11 years ago

Thanks Karl, I have tried the way which is mentioned in the link . Still i have same issue .

App get resigned and gets installed , when i open the application manually nothing happens .

Looking forward for this issue to be fixed .

If i build the Xamarin application from Xamarin Studio and can i test that apk file with calabash on the same machine ?

saikrishna321 commented 11 years ago

Hi Karl ,

I get the below error when running on mac os

sh resign.sh FieldService.Android.apk /tmp/tmp_path_for_resigned.apk zip warning: name not matched: META-INF/*

zip error: Nothing to do! (FieldService.Android.apk) must reference a valid KeyStore key entry containing a private key and corresponding public key certificate chain. mv: rename /tmp/tmp_path_for_resigned.apk\r to FieldService.Android.apk\r: No such file or directory Photons-MacBook-Pro:hi photon$