Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-46437

Android Signing plugin cannot find zipalign on Linux

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Major Major
    • android-signing-plugin
    • Jenkins 2.69/Android Signing Plugin 2.2.5 running on Kubernetes 1.6. The actual build machine is Debian Jesse within a Docker container running as a Jenkins slave.

      Signing APKs in a Jenkins Pipeline fails with following message:

       

      [Test_Sign_APK] Running shell script
      + ls -l /opt/android-sdk/build-tools/26.0.1/zipalign
      -rwxr-xr-x. 1 android android 131217 Aug  9 15:53 /opt/android-sdk/build-tools/26.0.1/zipalign
      [Pipeline] signAndroidApks
      Executing shell script inside container [imeet-android-sdk] of pod [jenkins-slave-jdq6t-l2nht]
      Executing command: "echo" ""resolving effective environment"" 
      printf "EXITCODE %3d" $?; exit
      # cd "/home/jenkins/workspace/Test_Sign_APK"
      "echo" ""resolving effective environment"" 
      printf "EXITCODE %3d" $?; exit
      # resolving effective environment
      # EXITCODE   0[SignApksBuilder] zipalign path explicitly set to /opt/android-sdk/build-tools/26.0.1/zipalign
      [SignApksBuilder] no zipalign or zipalign.exe found in path /opt/android-sdk/build-tools/26.0.1
      [Pipeline] }
      [Pipeline] // stage
      [Pipeline] }
      [Pipeline] // container
      [Pipeline] }
      [Pipeline] // node
      [Pipeline] }
      [Pipeline] // podTemplate
      [Pipeline] End of Pipeline
      ERROR: failed to find zipalign path in parameters or environment
      Finished: FAILURE

       

      Note in the second line that I the pipeline (code below) runs 'ls -l' on the full path of zipalign and it returns successfully with the correct file and permissions.

      The relevant Pipeline code snipped for brevity:

       

      env.ANDROID_HOME = '/opt/android-sdk'
      env.ANDROID_ZIPALIGN = '/opt/android-sdk/build-tools/26.0.1/zipalign'
      
      <snip>
      
      stage ('Sign APK') {
        sh "ls -l ${ANDROID_ZIPALIGN}"
          signAndroidApks (
          keyStoreId: "AndroidSigningKeystore",
          keyAlias: "AndroidSigningKeystore",
          apksToSign: "**/*.apk",
          // uncomment the following line to output the signed APK to a separate directory as described above
          // signedApkMapping: [ $class: UnsignedApkBuilderDirMapping ] 
          // uncomment the following line to output the signed APK as a sibling of the unsigned APK, as described above, or just omit signedApkMapping
          // you can override these within the script if necessary 
          // androidHome: env.ANDROID_HOME 
          zipalignPath: env.ANDROID_ZIPALIGN
        )
      }

       

       

       

            restjohn Robert St. John
            gteshome Gashaw Teshome
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: