我要簽名的機器人.apk
,我已經得到了以下配置文件設置在我pom.xml
的Android行家的jarsigner,的jarsigner:嘗試重新命名X,但失敗了
<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後的建議)以將文物移出,但這似乎沒有任何效果,可能是由於我沒有正確使用它。
有什麼建議嗎?
乾杯
編輯:如果我拿出從錯誤信息的命令,並運行,爲mypassword
代'*****'
,它工作正常....
只要看看:丹尼斯·倫德伯格評論](http://jira.codehaus.org/browse /MJARSIGNER-13?focusedCommentId=332952&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-332952) –