calabash / calabash-android

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

META-INF CERT.RSA not detected #938

Open vitaminac opened 3 years ago

vitaminac commented 3 years ago

The latest version of calabash-android has problem detecting CERT.RSA file.

C:\Users\xxxxxxxx>bundle exec calabash-android run app-debug.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 DEBUG: Setting Android SDK location to $ANDROID_HOME DEBUG: Android SDK location set to 'C:\Users\ziyao\AppData\Local\Android\Sdk' DEBUG: Set aapt path to 'C:\Users\ziyao\AppData\Local\Android\Sdk/build-tools/30.0.3/aapt.exe' DEBUG: Set zipalign path to 'C:\Users\ziyao\AppData\Local\Android\Sdk/build-tools/30.0.3/zipalign.exe' DEBUG: Set adb path to 'C:\Users\ziyao\AppData\Local\Android\Sdk/platform-tools/adb.exe' DEBUG: Set android jar path to 'C:\Users\ziyao\AppData\Local\Android\Sdk/platforms/android-30/android.jar' DEBUG: Setting Java SDK location to $JAVA_HOME DEBUG: Java SDK location set to 'C:\Program Files\Java\jdk1.8.0_201' DEBUG: Found java on PATH DEBUG: Set java path to '\Program Files\Common Files\Oracle\Java\javapath/java.exe' DEBUG: Set keytool path to 'C:\Program Files\Java\jdk1.8.0_201/bin/keytool.exe' DEBUG: Set jarsigner path to 'C:\Program Files\Java\jdk1.8.0_201/bin/jarsigner.exe' WARNING: skipped META-INF/CERT.RSA as unsafe 2021-05-08 12:34:36 - Signature files: Traceback (most recent call last): 10: from C:/Ruby25-x64/bin/calabash-android:23:in <main>' 9: from C:/Ruby25-x64/bin/calabash-android:23:inload' 8: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/calabash-android-0.9.20/bin/calabash-android:86:in <top (required)>' 7: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/calabash-android-0.9.20/bin/calabash-android-run.rb:16:incalabash_run' 6: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/calabash-android-0.9.20/lib/calabash-android/helpers.rb:107:in build_test_server_if_needed' 5: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/calabash-android-0.9.20/bin/calabash-android-build.rb:2:incalabash_build' 4: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/calabash-android-0.9.20/lib/calabash-android/helpers.rb:169:in fingerprint_from_apk' 3: from C:/Ruby25-x64/lib/ruby/2.5.0/tmpdir.rb:89:inmktmpdir' 2: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/calabash-android-0.9.20/lib/calabash-android/helpers.rb:170:in block in fingerprint_from_apk' 1: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/calabash-android-0.9.20/lib/calabash-android/helpers.rb:170:inchdir' C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/calabash-android-0.9.20/lib/calabash-android/helpers.rb:188:in `block (2 levels) in fingerprint_from_apk': No signature files found in META-INF. Cannot proceed. (RuntimeError)

calabash-android copy all .RSA files to a temporary directory and https://github.com/calabash/calabash-android/blob/e77dbf723a/ruby-gem/lib/calabash-android/helpers.rb#L176 failed to copy the .RSA because of this line of rubyzip https://github.com/rubyzip/rubyzip/blob/7f3bb294872048c98f885d96f8bddf3668201a4a/lib/zip/entry.rb#L210

JoeSSS commented 3 years ago

did it start just with version 0.9.20 ? there is another thread about that problem: https://github.com/calabash/calabash-android/issues/802

JoeSSS commented 3 years ago

@igorFedotenkov most likely related to the latest rubyzip bump https://github.com/calabash/calabash-android/commit/af5e3be7d51a6b7db9a75a3a384bd6556c3812b8#diff-04ff53c4c09c9939a1d7dcce85419cddaec67a4ad76f900bd553564e401adaf2R47

JoeSSS commented 3 years ago

can we pin it back?

JoeSSS commented 3 years ago

@vitaminac can you try again with 0.9.22 version please?

vitaminac commented 3 years ago

rubyzip has this behaviour since v1.2.2 https://github.com/rubyzip/rubyzip/commit/3dd165b494f29d410184b2a135ed99527d4b4aa8, we need to have v1.2.1 to solve the problem, see this comment as well https://github.com/calabash/calabash-android/issues/802#issuecomment-420544222, another solution is to pass dest_path as parameter when calling extract here https://github.com/calabash/calabash-android/blob/master/ruby-gem/lib/calabash-android/helpers.rb#L176, see reference https://github.com/rubyzip/rubyzip/blob/7f3bb294872048c98f885d96f8bddf3668201a4a/lib/zip/entry.rb#L209

JoeSSS commented 3 years ago

I created the branch with 1.2.1. Could you please try to run tests with this version in Gemfile.

gem 'calabash-android', git: 'https://github.com/calabash/calabash-android.git', branch: 'downgrade_rubyzip'
JoeSSS commented 3 years ago

Unfortunately I cannot test it on my own

vitaminac commented 3 years ago

After specified calabash-android version to this branch the issue is solved, so I can remove rubyzip from my Gemfile

vitaminac commented 3 years ago

Hi could you merge downgrade_rubyzip to master, so anyone else can also solve the problem.