calabash / calabash-android

Automated Functional testing for Android using cucumber
Other
1.68k stars 618 forks source link

[Windows] No signature files found in META-INF. Cannot proceed. #802

Open d-konovalov opened 7 years ago

d-konovalov commented 7 years ago

When I run this command: calabash-android build BuildName.apk on mac all works as expected but if I try to do it on windows I get next error:

C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/calabash-android-0.9.0/lib/calabash-android/helpers.rb:188:in `block (2 levels) in fingerprint_from_apk': No signature files found in META-INF. Cannot proceed. (RuntimeError) from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/calabash-android-0.9.0/lib/calabash-android/helpers.rb:170:in `chdir' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/calabash-android-0.9.0/lib/calabash-android/helpers.rb:170:in `block in fingerprint_from_apk' from C:/Ruby22-x64/lib/ruby/2.2.0/tmpdir.rb:88:in `mktmpdir' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/calabash-android-0.9.0/lib/calabash-android/helpers.rb:169:in `fingerprint_from_apk' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/calabash-android-0.9.0/bin/calabash-android-build.rb:2:in `calabash_build' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/calabash-android-0.9.0/bin/calabash-android:72:in `<top (required)>' from C:/Ruby22-x64/bin/calabash-android:23:in `load' from C:/Ruby22-x64/bin/calabash-android:23:in `<main>'

Please help me to find what I do wrong Best regards

TobiasRoikjer commented 7 years ago

The application is not signed, you need to run the resign command. e.g. calabash-android resign <apk>. (I also heavily recommend you use bundler to manage you gem versions)

d-konovalov commented 7 years ago

Thank you for super fast response @TobiasRoikjer once i've tried to execute command you just provided I get this error message:

C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/calabash-android-0.9.0/lib/calabash-android/java_keystore.rb:60:in `sign_apk': Could not sign app: C:/Users/Test/AppData/Local/Temp/d20170117-6456-w7dzrc/unsigned.apk (RuntimeError)
    from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/calabash-android-0.9.0/lib/calabash-android/helpers.rb:164:in `sign_apk'
    from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/calabash-android-0.9.0/lib/calabash-android/helpers.rb:119:in `block in resign_apk'
    from C:/Ruby22-x64/lib/ruby/2.2.0/tmpdir.rb:88:in `mktmpdir'
    from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/calabash-android-0.9.0/lib/calabash-android/helpers.rb:113:in `resign_apk'
    from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/calabash-android-0.9.0/bin/calabash-android:133:in `<top (required)>'
    from C:/Ruby22-x64/bin/calabash-android:23:in `load'
    from C:/Ruby22-x64/bin/calabash-android:23:in `<main>'
 2017-01-17 13:25:24 - Resign apk
 DEBUG: Setting Android SDK location to $ANDROID_HOME
 DEBUG: Android SDK location set to 'C:\Users\Test\AppData\Local\Android\Sdk'
 DEBUG: Set aapt path to 'C:\Users\Test\AppData\Local\Android\Sdk/build-tools/25.0.2/aapt.exe'
 DEBUG: Set zipalign path to 'C:\Users\Test\AppData\Local\Android\Sdk/build-tools/25.0.2/zipalign.exe'
 DEBUG: Set adb path to 'C:\Users\Test\AppData\Local\Android\Sdk/platform-tools/adb.exe'
 DEBUG: Set android jar path to 'C:\Users\Test\AppData\Local\Android\Sdk/platforms/android-25/android.jar'
 DEBUG: Setting Java SDK location from HKEY_LOCAL_MACHINE SOFTWARE\JavaSoft\Java Development Kit\1.8
 DEBUG: Java SDK location set to 'C:\Program Files\Java\jdk1.8.0_111'
 DEBUG: Found java on PATH
 DEBUG: Set java path to '\Program Files\Java\jre1.8.0_111\bin/java.exe'
 DEBUG: Found keytool on PATH
 DEBUG: Set keytool path to '\Program Files\Java\jre1.8.0_111\bin/keytool.exe'
 DEBUG: Found jarsigner on PATH
 DEBUG: Set jarsigner path to '\Program Files\Java\jdk1.8.0_111\bin/jarsigner.exe'
TobiasRoikjer commented 7 years ago

@d-konovalov What is the full ouput (including the command you have executed)?

d-konovalov commented 7 years ago

The next line is attempt to build it calabash-android build <apk-file>

TobiasRoikjer commented 7 years ago

@d-konovalov Run using DEBUG=1 bundle exec calabash-android resign <apk> -v

Look for the line below Signing using the digest algorithm: . Try executing that command on its own

d-konovalov commented 7 years ago

@TobiasRoikjer It seems that resign worked without errors

[split_1] DEBUG=1 bundle exec calabash-android resign Music.Droid.YouSee_3.5.0.380.apk -v
[split_1] cp ./keystores/yousee_calabash_settings ./.calabash_settings
[split_1] bundle exec calabash-android build Music.Droid.YouSee_3.5.0.380.apk
[split_1] C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/calabash-android-0.9.0/lib/calabash-android/helpers.rb:188:in `block (2 levels) in fingerprint_from_apk': No signature files found in META-INF. Cannot proceed. (RuntimeError)
[split_1]   from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/calabash-android-0.9.0/lib/calabash-android/helpers.rb:170:in `chdir'
[split_1]   from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/calabash-android-0.9.0/lib/calabash-android/helpers.rb:170:in `block in fingerprint_from_apk'
[split_1]   from C:/Ruby22-x64/lib/ruby/2.2.0/tmpdir.rb:88:in `mktmpdir'
[split_1]   from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/calabash-android-0.9.0/lib/calabash-android/helpers.rb:169:in `fingerprint_from_apk'
[split_1]   from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/calabash-android-0.9.0/bin/calabash-android-build.rb:2:in `calabash_build'
[split_1]   from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/calabash-android-0.9.0/bin/calabash-android:72:in `<top (required)>'
[split_1]   from C:/Ruby22-x64/bin/calabash-android:23:in `load'
[split_1]   from C:/Ruby22-x64/bin/calabash-android:23:in `<main>'
[split_1] 2017-01-17 16:25:51 - Signature files:

But as you can see the initial error message is still available

Thanks

TobiasRoikjer commented 7 years ago

You have to build the the same .calabash_settings as the ones you use to resign it.

d-konovalov commented 7 years ago

hm you mean I should run resign command after I copy .calabash_settings file?

TobiasRoikjer commented 7 years ago

Yes. Calabash has to have a server (created using build) signed used the same credentials as the app under test (resigned using resign)

d-konovalov commented 7 years ago

I've changed order of these actions but the output is the same (

[split_1] cp ./keystores/yousee_calabash_settings ./.calabash_settings
[split_1] DEBUG=1 bundle exec calabash-android resign Music.Droid.YouSee_3.5.0.380.apk -v
[split_1] bundle exec calabash-android build Music.Droid.YouSee_3.5.0.380.apk
[split_1] C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/calabash-android-0.9.0/lib/calabash-android/helpers.rb:188:in `block (2 levels) in fingerprint_from_apk': No signature files found in META-INF. Cannot proceed. (RuntimeError)
[split_1]   from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/calabash-android-0.9.0/lib/calabash-android/helpers.rb:170:in `chdir'
[split_1]   from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/calabash-android-0.9.0/lib/calabash-android/helpers.rb:170:in `block in fingerprint_from_apk'
[split_1]   from C:/Ruby22-x64/lib/ruby/2.2.0/tmpdir.rb:88:in `mktmpdir'
[split_1]   from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/calabash-android-0.9.0/lib/calabash-android/helpers.rb:169:in `fingerprint_from_apk'
[split_1]   from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/calabash-android-0.9.0/bin/calabash-android-build.rb:2:in `calabash_build'
[split_1]   from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/calabash-android-0.9.0/bin/calabash-android:72:in `<top (required)>'
[split_1]   from C:/Ruby22-x64/bin/calabash-android:23:in `load'
[split_1]   from C:/Ruby22-x64/bin/calabash-android:23:in `<main>'
[split_1] 2017-01-17 16:54:28 - Signature files:
TobiasRoikjer commented 7 years ago

@d-konovalov Unzip the apk after running resign, and look into the directory named META-INF, what do you see?

d-konovalov commented 7 years ago

I can see MANIFEST.MF, CERT.SF and CERT.RSA files i just did resign locally and saw valid output without any errors the errors i posted here copied from remote run (via jenkins) from the same machine after resigning locally calabash-android build <apk> worked without any errors :(

TobiasRoikjer commented 7 years ago

To confirm, on the CI machine, you resigned the app, and on the CI machine, you unzipped the app, and saw those files in the META-INF directory?

d-konovalov commented 7 years ago

Yep I did it manually on that machine and succeeded but when i try to resign it remotely with script I see the error again (after resign step)

TobiasRoikjer commented 7 years ago

And you are doing it from the same directory and user as the CI script is running as?

d-konovalov commented 7 years ago

The directory is the same but I'm not sure about the user

d-konovalov commented 7 years ago

This one is still happens when triggered by CI

C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/calabash-android-0.9.0/lib/calabash-android/java_keystore.rb:60:in `sign_apk': Could not sign app: C:/Users/Test/AppData/Local/Temp/d20170117-7352-1c81xzp/unsigned.apk (RuntimeError)

TobiasRoikjer commented 7 years ago

To confirm, that happens when you execute build, and not resign?

d-konovalov commented 7 years ago

That's right When 'resign':

C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/calabash-android-0.9.0/lib/calabash-android/java_keystore.rb:60:in `sign_apk': Could not sign app: C:/Users/Test/AppData/Local/Temp/d20170117-7352-1c81xzp/unsigned.apk (RuntimeError)

When 'build' I see the error from the first message:

C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/calabash-android-0.9.0/lib/calabash-android/helpers.rb:188:in block (2 levels) in fingerprint_from_apk': No signature files found in META-INF. Cannot proceed. (RuntimeError) from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/calabash-android-0.9.0/lib/calabash-android/helpers.rb:170:inchdir' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/calabash-android-0.9.0/lib/calabash-android/helpers.rb:170:in block in fingerprint_from_apk' from C:/Ruby22-x64/lib/ruby/2.2.0/tmpdir.rb:88:inmktmpdir' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/calabash-android-0.9.0/lib/calabash-android/helpers.rb:169:in fingerprint_from_apk' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/calabash-android-0.9.0/bin/calabash-android-build.rb:2:incalabash_build' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/calabash-android-0.9.0/bin/calabash-android:72:in <top (required)>' from C:/Ruby22-x64/bin/calabash-android:23:inload' from C:/Ruby22-x64/bin/calabash-android:23:in `

'

andreroggeri commented 6 years ago

Probably you're using the JDK 151 or 152.

These versions of JDK changed the way that keytool works.

The quick fix for this is downgrading the JDK to 144 (previous version). And your error should be fixed

ruttuk commented 6 years ago

Hello, I am having the exact same issue. I've tried downgrading to JDK 144 and still I see the following:

bundle exec calabash-android run kingmaker.apk
WARNING: skipped META-INF/CERT.RSA as unsafe
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/calabash-android-0.9.6/lib/calabash-android/helpers.rb:188:in `block (2 levels) in fingerprint_from_apk': No signature files found in META-INF. Cannot proceed. (RuntimeError)
KGMSathish commented 6 years ago

Guys i'm also facing same issue, after resigning the apk(resigning will be success)

Resign

D:\test>bundle exec calabash-android resign app-staging.apk

D:\test>

When i do run/build

D:\test>bundle exec calabash-android run app-staging.apk No test server found for this combination of app and calabash version. Recreating test server. *** WARNING: You must use ANSICON 1.31 or higher (https://github.com/adoxa/ansicon/) to get coloured output on Windows WARNING: skipped META-INF/CERT.RSA as unsafe C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/calabash-android-0.9.6/lib/calabash-android/helpers.rb:188:in block (2 levels) in fingerprint_from_apk': No s re files found in META-INF. Cannot proceed. (RuntimeError) from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/calabash-android-0.9.6/lib/calabash-android/helpers.rb:170:inchdir' from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/calabash-android-0.9.6/lib/calabash-android/helpers.rb:170:in block in fingerprint_from_apk' from C:/Ruby23-x64/lib/ruby/2.3.0/tmpdir.rb:89:inmktmpdir' from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/calabash-android-0.9.6/lib/calabash-android/helpers.rb:169:in fingerprint_from_apk' from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/calabash-android-0.9.6/bin/calabash-android-build.rb:2:incalabash_build' from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/calabash-android-0.9.6/lib/calabash-android/helpers.rb:107:in build_test_server_if_needed' from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/calabash-android-0.9.6/bin/calabash-android-run.rb:16:incalabash_run' from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/calabash-android-0.9.6/bin/calabash-android:86:in <top (required)>' from C:/Ruby23-x64/bin/calabash-android:22:inload' from C:/Ruby23-x64/bin/calabash-android:22:in `

'

ruttuk commented 6 years ago

@KGMSathish try downgrading the version of calabash-android to 0.9.5 and rubyzip to 1.2.1.

SathishKadavanna commented 6 years ago

@ruttuk Thanks a tonne, i removed ruby fully & installed Ruby 2.5.1, RubyZip 1.2.1, Calabash-Android 0.9.5 With this its working fine. Thanks @ruttuk :100:

shahbaz-qaiser-10p commented 4 years ago

@TobiasRoikjer facing the same issue can you help me with it?

GiuseppeGiacoppo commented 3 years ago

@shahbaz-qaiser-10p I had problems even with ruttuk's solution. On Windows I solved installing Ruby+Devkit instead of Ruby alone. Then created a Gemfile specifying RubyZip 1.2.1 and calabash-android 0.9.5 and it worked.

JoeSSS commented 3 years ago

hey does it still happen with 0.9.22 version of the gem?