title: What kind of pitfals exist for the Android APK signing?
body: <p>Disclaimer: <strong>I know the basics of signing an APKs and I have a problem with only one of my projects and only when signing with Microsoft Windows as the OS.</strong></p>
  
  <p>I am building my APK with <a href="http://en.wikipedia.org/wiki/Apache_Maven" rel="nofollow">Maven</a> and sign them with the maven-jarsigner-plugin:</p>
  
  <pre><code>  &lt;plugin&gt;
      &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
      &lt;artifactId&gt;maven-jarsigner-plugin&lt;/artifactId&gt;
      &lt;executions&gt;
        &lt;execution&gt;
          &lt;id&gt;signing&lt;/id&gt;
          &lt;goals&gt;
            &lt;goal&gt;sign&lt;/goal&gt;
          &lt;/goals&gt;
          &lt;phase&gt;package&lt;/phase&gt;
          &lt;inherited&gt;true&lt;/inherited&gt;
          &lt;configuration&gt;
            &lt;archive&gt;target/${project.build.finalName}.apk&lt;/archive&gt;
            &lt;sigfile&gt;CERT&lt;/sigfile&gt;
            &lt;keystore&gt;${env.HOME}/.keystore&lt;/keystore&gt;
            &lt;storepass&gt;${env.KEY_STOREPASS}&lt;/storepass&gt;
            &lt;keypass&gt;${env.KEY_KEYPASS}&lt;/keypass&gt;
            &lt;alias&gt;${env.KEY_ALIAS}&lt;/alias&gt;
          &lt;/configuration&gt;
        &lt;/execution&gt;
      &lt;/executions&gt;
    &lt;/plugin&gt;
  </code></pre>
  
  <p>Now with one of my projects I get the following error when trying to install and start the application:</p>
  
  <pre><code>1360 KB/s (2057872 bytes in 1.477s)
          pkg: /data/local/tmp/FX-602P-Droid-5.0.0.apk
  Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES]
  </code></pre>
  
  <p>As I said in the first sentence: It works fine when signing with Mac OS X. It only fails when using Windows 7 to sign.</p>
  
  <p>Using <code>--debug</code> when calling Maven I see that the jarsigner is called ok and reports no error:</p>
  
  <pre><code>[INFO]
  [INFO] --- maven-jarsigner-plugin:1.2:sign (signing) @ FX-602P-Droid ---
  [DEBUG] org.apache.maven.plugins:maven-jarsigner-plugin:jar:1.2:
  [DEBUG]    org.apache.maven:maven-plugin-api:jar:2.0.6:compile
  [DEBUG]    org.apache.maven:maven-project:jar:2.0.6:compile
  [DEBUG]       org.apache.maven:maven-settings:jar:2.0.6:compile
  [DEBUG]       org.apache.maven:maven-profile:jar:2.0.6:compile
  [DEBUG]       org.apache.maven:maven-model:jar:2.0.6:compile
  [DEBUG]       org.apache.maven:maven-artifact-manager:jar:2.0.6:compile
  [DEBUG]          org.apache.maven:maven-repository-metadata:jar:2.0.6:compile
  [DEBUG]       org.apache.maven:maven-plugin-registry:jar:2.0.6:compile
  [DEBUG]       org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1:compile
  [DEBUG]          junit:junit:jar:3.8.1:compile
  [DEBUG]          classworlds:classworlds:jar:1.1-alpha-2:compile
  [DEBUG]    org.apache.maven:maven-artifact:jar:2.0.6:compile
  [DEBUG]    org.codehaus.plexus:plexus-utils:jar:1.5.15:compile
  [DEBUG] Created new class realm plugin&gt;org.apache.maven.plugins:maven-jarsigner-plugin:1.2
  [DEBUG] Importing foreign packages into class realm plugin&gt;org.apache.maven.plugins:maven-jarsigner-plugin:1.2
  [DEBUG]   Imported:  &lt; project&gt;net.sourceforge.uiq3:FX-602P-Droid:5.0.0
  [DEBUG] Populating class realm plugin&gt;org.apache.maven.plugins:maven-jarsigner-plugin:1.2
  [DEBUG]   Included: org.apache.maven.plugins:maven-jarsigner-plugin:jar:1.2
  [DEBUG]   Included: junit:junit:jar:3.8.1
  [DEBUG]   Included: org.codehaus.plexus:plexus-utils:jar:1.5.15
  [DEBUG]   Excluded: org.apache.maven:maven-plugin-api:jar:2.0.6
  [DEBUG]   Excluded: org.apache.maven:maven-project:jar:2.0.6
  [DEBUG]   Excluded: org.apache.maven:maven-settings:jar:2.0.6
  [DEBUG]   Excluded: org.apache.maven:maven-profile:jar:2.0.6
  [DEBUG]   Excluded: org.apache.maven:maven-model:jar:2.0.6
  [DEBUG]   Excluded: org.apache.maven:maven-artifact-manager:jar:2.0.6
  [DEBUG]   Excluded: org.apache.maven:maven-repository-metadata:jar:2.0.6
  [DEBUG]   Excluded: org.apache.maven:maven-plugin-registry:jar:2.0.6
  [DEBUG]   Excluded: org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1
  [DEBUG]   Excluded: classworlds:classworlds:jar:1.1-alpha-2
  [DEBUG]   Excluded: org.apache.maven:maven-artifact:jar:2.0.6
  [DEBUG] Configuring mojo org.apache.maven.plugins:maven-jarsigner-plugin:1.2:sign from plugin realm ClassRealm[plugin&gt;org.apache.maven.plugins:maven-jarsigner-plugin:1.
  2, parent: sun.misc.Launcher$AppClassLoader@214c4ac9]
  [DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-jarsigner-plugin:1.2:sign' with basic configurator --&gt;
  [DEBUG]   (f) alias = krischik
  [DEBUG]   (f) archive = C:\Work\uiq3\Java\FX-602P-Droid\target\FX-602P-Droid-5.0.0.apk
  [DEBUG]   (f) arguments = []
  [DEBUG]   (f) keypass = Atlan.
  [DEBUG]   (f) keystore = C:\Users\martin.krischik/.keystore
  [DEBUG]   (f) processAttachedArtifacts = true
  [DEBUG]   (f) processMainArtifact = true
  [DEBUG]   (f) project = MavenProject: net.sourceforge.uiq3:FX-602P-Droid:5.0.0 @ C:\Work\uiq3\Java\FX-602P-Droid\pom.xml
  [DEBUG]   (f) removeExistingSignatures = false
  [DEBUG]   (f) sigfile = CERT
  [DEBUG]   (f) skip = false
  [DEBUG]   (f) storepass = !AtlanRhodan!
  [DEBUG]   (f) verbose = false
  [DEBUG] -- end configuration --
  [DEBUG] Verarbeite C:\Work\uiq3\Java\FX-602P-Droid\target\FX-602P-Droid-5.0.0.apk
  [DEBUG] 'cmd.exe /X /C "C:\opt\Java\jdk\1.7.0\bin\jarsigner.exe -keystore C:\Users\martin.krischik/.keystore -storepass '*****' -keypass '*****' -sigfile CERT C:\Work\u
  iq3\Java\FX-602P-Droid\target\FX-602P-Droid-5.0.0.apk krischik"'
  [INFO] 1 Archiv(e) verarbeitet
  [INFO]
  </code></pre>
  
  <p>What else could have gone wrong?</p>
  
  <p>PS: I just noted <code>C:\opt\Java\jdk\1.7.0\bin\jarsigner.exe</code> — Has there been a change to the jarsigner from 1.6 to 1.7? And why would Maven use the 1.7 signer for a 1.6 project?</p>