Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Automation for Android release build

Tags:

I have ten Android projects in one folder. For each project, I can use ant debug to build it. So it is no problem to write a simple script to compile all these projects. I use Hudson to build these projects daily, and it works fine.

But now our project needs to go to release phase. So the compile command becomes ant release. For compiling a release project, I have to enter the password for the certificate every time during compilation. So I can't do the automation for release.

This compiling job kills me since I have ten projects that all need to interact with inputting the password.

How can I make the release build still be automatic?

like image 252
pan Avatar asked Mar 17 '11 02:03

pan


People also ask

What is fastlane for Android?

fastlane is an open source platform aimed at simplifying Android and iOS deployment. fastlane lets you automate every aspect of your development and release workflow.

Can we automate Android app?

UI Automator Based on the features mentioned before, Appium is the most popular and preferred choice for Mobile Automation for Android devices. The most important reason for Appium as a preferred choice is because the same programming language can be used to automate both iOS and Android operating systems.

What is fastlane automation?

What is fastlane? fastlane can be simply described as the easiest way to automate building and release your iOS and Android apps, via a suite of tools that can work either autonomously or in tandem to accomplish tasks such as: Automation of building and packaging iOS apps producing . ipa files.


1 Answers

Assuming you're using recent Android tools, say v9 or v10.

If you look at tools/ant/main_rules.xml in the Android SDK directory:

<!-- called through target 'release'. Only executed if the keystore and      key alias are known but not their password. --> <target name="-release-prompt-for-password" if="has.keystore" unless="has.password">     <!-- Gets passwords -->     <input             message="Please enter keystore password (store:${key.store}):"             addproperty="key.store.password" />     <input             message="Please enter password for alias '${key.alias}':"             addproperty="key.alias.password" /> </target>  <!-- called through target 'release'. Only executed if there's no      keystore/key alias set --> <target name="-release-nosign" unless="has.keystore">     <echo>No key.store and key.alias properties found in build.properties.</echo>     <echo>Please sign ${out.unsigned.file} manually</echo>     <echo>and run zipalign from the Android SDK tools.</echo> </target> 

Searching the XML file for has.keystore reveals:

<!-- properties for signing in release mode --> <condition property="has.keystore">     <and>         <isset property="key.store" />         <length string="${key.store}" when="greater" length="0" />         <isset property="key.alias" />     </and> </condition> <condition property="has.password">     <and>         <isset property="has.keystore" />         <isset property="key.store.password" />         <isset property="key.alias.password" />     </and> </condition> 

So I'd assume you have to pass in four defines to the build.xml: key.store, key.alias, key.store.password, key.alias.password.

And remember not to pass those defines on the command line for security reasons. :)

like image 165
typo.pl Avatar answered Dec 08 '22 07:12

typo.pl