Android signing with Ant
If you have Ant version < 1.8.3 (ant -version
) try this approach for the issue with JDK 7 (based on the previous answer):
Add signjarjdk7 to ANDROID_SDK\tools\ant\build.xml
<macrodef name="signjarjdk7">
<attribute name="jar" />
<attribute name="signedjar" />
<attribute name="keystore" />
<attribute name="storepass" />
<attribute name="alias" />
<attribute name="keypass" />
<attribute name="verbose" />
<sequential>
<exec executable="jarsigner" failonerror="true">
<!-- Magic key, always verbose -->
<arg line="-verbose -digestalg SHA1 -sigalg MD5withRSA" />
<arg line="-keystore @{keystore} -storepass @{storepass} -keypass @{keypass}" />
<arg line="-signedjar "@{signedjar}"" />
<arg line=""@{jar}" @{alias}" />
</exec>
</sequential>
</macrodef>Replace
'signjar'
to'signjarjdk7'
in'release'
target in the same build.xml.
NOTE: You have to define 'key.store.password' and 'key.alias.password' propeties for your project (in project.properties or in local.properties).
UPDATE 1:
If your have installed Ant 1.8.3 (or later) you have a better solution:
Open your ANDROID_SDK\tools\ant\build.xml and add two new parameters - sigalg and digestalg - in the original 'signjar' invocation:
<signjar
sigalg="MD5withRSA"
digestalg="SHA1"
jar="${out.packaged.file}"
signedjar="${out.unaligned.file}"
keystore="${key.store}"
storepass="${key.store.password}"
alias="${key.alias}"
keypass="${key.alias.password}"
verbose="${verbose}" />
UPDATE 2:
It seems this answer is deprecated after 'signjar' was replaced to 'signapk' in latest version of Android SDK tools.
Signing Android application using ANT
You should just create an ant.properties file in your main project directory. Then edit it to be like my answer to this question:
signing applications automatically with password in ant
signing applications automatically with password in ant
I just have these lines in my ant.properties and it signs automatically
key.store.password=mypasswordOne
key.alias.password=mypasswordTwo
key.store=c:/users/myname/my-release-key.keystore
key.alias=release_alias
Building both signed and unsigned releases with Ant
You don't need to zipalign the package, because, according to this question, amazon will zipalign the package after they sign it.
And according to this page on the Android developer site, zip aligning of the unsigned package is useless, because the signing operation that amazon will do will de-align the package.
Ant Build Signing Jar
It looks like you have to add the following in the /tools/ant/build.xml
<signjar
sigalg="MD5withRSA"
digestalg="SHA1">
Building Android APK with Ant ignores signing password
I've solved the problem - the keystore password and alias password were identical. This seemed to allow the signing process using ant to pass when entering the wrong password for the alias.
If I make the passwords differ, the build process does indeed fail if the wrong alias password is entered.
Related Topics
How to Call a Wcf Service Using Ksoap2 on Android
Using Onbackpressed() in Android Fragments
Android How to Wait Until a Service Is Actually Connected
Programmatically Lock into Portrait Mode for Certain Operations
Way to Protect from Lucky Patcher/Play Licensing
How to Access Resource with Dynamic Name in My Case
How to Make Part of The Text Bold in Android at Runtime
How to Scale a Streaming Bitmap In-Place Without Reading The Whole Image First
Changing Numberpicker Divider Color
Generating iOS and Android Icons in Cordova/Phonegap
How to Enable Autostart Option for My App in Xiaomi Phone Security App Programmatically in Android
Android Device Monitor "Data" Folder Is Empty
Android: Wait on User Input from Dialog
Set Textcursordrawable Programmatically