jarsigner错误:java.util.zip.ZipException:ZIP文件必须至少有一个条目

时间:2014-07-22 13:09:29

标签: java android maven apk jarsigner

我尝试使用jarsigner在我的pom文件中使用以下内容签署apk:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-jarsigner-plugin</artifactId>
    <version>1.3.2</version>
    <executions>
        <execution>
            <id>signing</id>
            <goals>
                <goal>sign</goal>
            </goals>
            <phase>package</phase>
            <inherited>true</inherited>
            <configuration>
                <archiveDirectory></archiveDirectory>
                <includes>
                    <include>target/*.apk</include>
                </includes>
                <keystore>${keystore}</keystore>
                <storepass>${password}</storepass>
                <keypass>${password}</keypass>
                <alias>rimbit</alias>
                <arguments>
                  <argument>-sigalg</argument><argument>SHA256withRSA</argument>
                  <argument>-digestalg</argument><argument>SHA256</argument>
                </arguments>
            </configuration>
        </execution>
    </executions>
</plugin>

但在构建过程中我得到了这个:

[DEBUG] Configuring mojo org.apache.maven.plugins:maven-jarsigner-plugin:1.3.2:sign from plugin realm ClassRealm[plugin>org.apache.maven.plugins:maven-jarsigner-plugin:1.3.2, parent: sun.misc.Launcher$AppClassLoader@48c4fedd]
[DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-jarsigner-plugin:1.3.2:sign' with basic configurator -->
[DEBUG]   (f) alias = rimbit
[DEBUG]   (f) arguments = [-sigalg, SHA256withRSA, -digestalg, SHA256]
[DEBUG]   (f) includes = [target/*.apk]
[DEBUG]   (f) keypass = SECRET
[DEBUG]   (f) keystore = ../rimbit_wallet.keystore
[DEBUG]   (f) processAttachedArtifacts = true
[DEBUG]   (f) processMainArtifact = true
[DEBUG]   (f) protectedAuthenticationPath = false
[DEBUG]   (f) removeExistingSignatures = false
[DEBUG]   (f) skip = false
[DEBUG]   (f) storepass = SECRET
[DEBUG]   (f) verbose = false
[DEBUG]   (f) workingDirectory = /home/matt/Programming/ADT/workspace/rimbit-android-wallet/wallet
[DEBUG]   (f) project = MavenProject: com.rimbit.wallet:wallet:1.0 @ /home/matt/Programming/ADT/workspace/rimbit-android-wallet/wallet/pom.xml
[DEBUG]   (f) session = org.apache.maven.execution.MavenSession@10385cb0
[DEBUG] -- end configuration --
[DEBUG] Processing /home/matt/Programming/ADT/workspace/rimbit-android-wallet/wallet/target/wallet-1.0.apk
[DEBUG] /bin/sh -c cd /home/matt/Programming/ADT/workspace/rimbit-android-wallet/wallet && /usr/lib/jvm/java-6-openjdk-amd64/jre/../bin/jarsigner -keystore ../rimbit_wallet.keystore -storepass '*****' -sigalg SHA256withRSA -digestalg SHA256 -keypass '*****' /home/matt/Programming/ADT/workspace/rimbit-android-wallet/wallet/target/wallet-1.0.apk rimbit
[DEBUG] Executing: /bin/sh -c cd /home/matt/Programming/ADT/workspace/rimbit-android-wallet/wallet && /usr/lib/jvm/java-6-openjdk-amd64/jre/../bin/jarsigner -keystore ../rimbit_wallet.keystore -storepass '*****' -sigalg SHA256withRSA -digestalg SHA256 -keypass '*****' /home/matt/Programming/ADT/workspace/rimbit-android-wallet/wallet/target/wallet-1.0.apk rimbit
[DEBUG] jarsigner error: java.util.zip.ZipException: ZIP file must have at least one entry

1 个答案:

答案 0 :(得分:0)

好吧,我试图使用SHA256,但似乎jarsigner不允许这样做。那就是问题所在。我现在正在使用SHA1。