Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6582925
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:20:34+00:00 2026-05-25T16:20:34+00:00

I want to sign an android .apk , I’ve got the following profile setup

  • 0

I want to sign an android .apk, I’ve got the following profile setup in my 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>

I used the Novoda tutorial for the above (another similar example here which I’ve tried too, but same effect), and am executing mvn clean install -Prelease, however I get the following error :

[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] ------------------------------------------------------------------------

From what I can gather, the renaming is failing because that particular file is still in use during the packaging phase, so its essentially locked.

How can I correct this? I’m not entirely sure why a .jar is being signed, should it not just be the final .apk that gets signed?

I’ve tried to add a <destDir> (as suggested by a previous SO post) to move the artefacts out, but that doesn’t appear to have any effect, possibly due to me not using it correctly.

Any suggestions?

Cheers

EDIT : If I take out the command from the error message and run that, substituting '*****' for mypassword, it works fine….

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T16:20:35+00:00Added an answer on May 25, 2026 at 4:20 pm

    Tried all I could think of but could not get the maven-jarsigner-plugin to operate, however by using the maven-jar-plugin I was able to sign my application using that instead. Unfortunately that plugin is slightly deprecated and it refers to use the jarsigner plugin, but it worked for me.

    Wrote up a tutorial here for anyone else who may get stuck on this same issue.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to upload my first APK/app to the Android Market, but I got
My app uses the android.support.v4.view.ViewPager class. For each page in the ViewPager, I want
I made an Android app and want to release it under GNU GPL. When
This is my xml document. I want to sign only the userID part using
I want to sign up windows azure free trial , however no china options
I want to sign users in automatically after they create an account. My application
The reason I want to sign the dll is because I want to add
I want a simple sign in app in which a user logins successfully if
I want to give an alert after person sign up successfully. And then I
I want to develop a Single-Sign-On(SSO) or centralized authentication server (CAS) project for SSO

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.