gpt4 book ai didi

Android maven jarsigner,jarsigner : attempt to rename X but failed

转载 作者:行者123 更新时间:2023-11-30 04:32:41 28 4
gpt4 key购买 nike

我想签一个android .apk ,我的 pom.xml 中有以下配置文件设置

<profiles>
<profile><!-- release profile. uses keystore defined in keystore.* properties. signs and zipaligns the app to the target folder-->
<id>release</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<build>
<defaultGoal>install</defaultGoal>
<finalName>${project.artifactId}-${project.version}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jarsigner-plugin</artifactId>
<version>1.2</version>
<executions>
<execution>
<id>signing</id>
<goals>
<goal>sign</goal>
</goals>
<phase>package</phase>
<inherited>true</inherited>
<configuration>
<includes>
<include>
${project.build.directory}/target/${project.artifactId}-${project.version}.apk
</include>
</includes>
<keystore>my-release-key.keystore</keystore>
<storepass>mypasshere</storepass>
<keypass>mypasshere</keypass>
<alias>mykeystore</alias>
<verbose>true</verbose>
<!--<destDir>gen</destDir>-->
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>maven-android-plugin</artifactId>
<configuration>
<zipalign>
<verbose>true</verbose>
<skip>false</skip>
<!-- defaults to true -->
<inputApk>${project.build.directory}/${project.artifactId}-${project.version}.apk</inputApk>
<outputApk>${project.build.directory}/MyApp_v${project.version}.apk</outputApk>
</zipalign>
<sign>
<debug>false</debug>
</sign>
</configuration>
<executions>
<execution>
<id>zipalign</id>
<phase>verify</phase>
<goals>
<goal>zipalign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>

我使用了 Novoda tutorial对于上述(另一个类似的例子 here 我也尝试过,但效果相同),并且正在执行 mvn clean install -Prelease ,但是我收到以下错误:

[INFO] jarsigner: attempt to rename C:\android-projects\jameselsey_andsam_branch_mavenbranch\target\LanguageSelection-1.0.0-SNAPSHOT.jar to C:\android-projects\jameselsey_ands
am_branch_mavenbranch\target\LanguageSelection-1.0.0-SNAPSHOT.jar.orig failed
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed executing 'cmd.exe /X /C "C:\development\tools\Java\jdk1.6.0_20\jre\..\bin\jarsigner.exe -verbose -keystore my-release-key.keystore -storepass '*****' -keypass '
*****' C:\android-projects\jameselsey_andsam_branch_mavenbranch\target\LanguageSelection-1.0.0-SNAPSHOT.jar mykeystore"' - exitcode 1
[INFO] ------------------------------------------------------------------------

据我所知,重命名失败是因为该特定文件在打包阶段仍在使用,因此它基本上已锁定。

我该如何纠正这个问题?我不完全确定为什么 .jar正在签名,不应该只是最后的.apk那会被签名吗?

我尝试添加 <destDir> (如 previous SO 帖子所建议)将 Artifact 移出,但这似乎没有任何效果,可能是因为我没有正确使用它。

有什么建议吗?

干杯

编辑:如果我从错误消息中取出命令并运行它,替换为 '*****'对于 mypassword , 它工作正常....

最佳答案

尝试了所有我能想到的但无法让 maven-jarsigner-plugin 运行,但是通过使用 maven-jar-plugin 我能够签名我的应用程序使用它。不幸的是,该插件已被略微弃用,它指的是使用 jarsigner 插件,但它对我有用。

写了一个tutorial here对于可能陷入同一问题的任何其他人。

关于Android maven jarsigner,jarsigner : attempt to rename X but failed,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7421710/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com