<span style="font-family: Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);">使用maven自动打包并签名android应用后app无法安装,报错:INSTALL_PARSE_FAILED_NO_CERTIFICATES,解决方案如下:</span>
<span style="font-family: Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);"></span><pre name="code" class="html"><span style="white-space:pre"> </span>
<span style="font-family: Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);">只需要加入红色字体部分即可,删除已存在的签名。</span>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jarsigner-plugin</artifactId>
<version>1.2</version>
<executions>
<execution>
<id>sign</id>
<goals>
<goal>sign</goal>
</goals>
<phase>package</phase>
<inherited>true</inherited>
<configuration>
<includes>
<include>${project.build.outputDirectory}/*.apk</include>
</includes>
<span style="color:#ff6666;"><span style="white-space:pre"> </span><removeExistingSignatures>true</removeExistingSignatures></span>
<keystore>${keystore.filename}</keystore>
<storepass>${keystore.storepass}</storepass>
<keypass>${keystore.keypass}</keypass>
<alias>${keystore.alias}</alias>
</configuration>
</execution>
</executions>
</plugin>
如果使用JDK1.7以上的JDK版本,还需配置以下红线部分参数:
<configuration>
<span style="white-space:pre"> </span><includes>
<span style="white-space:pre"> </span><include>${project.build.outputDirectory}/*.apk</include>
<span style="white-space:pre"> </span></includes>
<span style="white-space:pre"> </span><removeExistingSignatures>true</removeExistingSignatures>
<span style="white-space:pre"> </span><keystore>${keystore.filename}</keystore>
<span style="white-space:pre"> </span><storepass>${keystore.storepass}</storepass>
<span style="white-space:pre"> </span><keypass>${keystore.keypass}</keypass>
<span style="white-space:pre"> </span><alias>${keystore.alias}</alias>
<span style="color:#ff6666;"><span style="white-space:pre"> </span><arguments>
<span style="white-space:pre"> </span><argument>-sigalg</argument>
<span style="white-space:pre"> </span><argument>MD5withRSA</argument>
<span style="white-space:pre"> </span><argument>-digestalg</argument>
<span style="white-space:pre"> </span><argument>SHA1</argument>
<span style="white-space:pre"> </span></arguments></span>
</configuration>