14 build and deploy your application

The construction and deployment of the application can be done in command line, we explain here how to do it using Eclipse.

First and foremost, must be that you define the location of a KeyStore in your workspace (your computer or on your network). This KeyStore will serve to centralize all of your keys to sign your applications. You must make sure of securing this folder and its persistence. Indeed, a third party should not be able to steal your keys because he would be able to use the same signature as you and hack your applications (to update a malware for example). Then, you should always be able to resign your application, particularly where it evolves. Indeed, if version 1 and version 2 of your application are not signed with the same key, the user will not be able to make an update of version 1 and will be obliged to install version 2 as if it were a new application.

The KeyStore has a password that you also keep as the KeyStore itself.

14.1 sign its application

Using Eclipse, nothing simpler: right click on your Android project-> Android Tool-> Export Signed Application Package...

The first window of the wizard checks that your project does not have errors, click next.

The second window, it asks you where your KeyStore, if you have not yet, set the folder that you will use to store your keys[1], otherwise find your KeyStore and fill in the password field.

The third window, allows you to create a key. A key has the following information:

  • Alias: An alias to the key, his first name. Only the first 8 characters are used
  • Password: The password associated with this key
  • Confirm: The password associated with this key
  • Validity (years): the validity (Android advocates at least 25, you can put a century)
  • First and Last Name: your first and last name (or the name of your team)
  • Organizational Unit: The service of your company that developed the application
  • Organization: The name of your company
  • City or locality: your city
  • State or Province: your State, your region, your Department
  • Country code: the code of your country[2], it is the same as that used for internationalization (US for USA, FR for France, UK for England...).

The last window asks you where the apk file must be registered.

14.1.1 create the KeyStore from command line

This method is for use only if you do not have Eclipse on your machine.

To create your KeyStore from the command line by using the keytool command (in your JAVA_HOME/bin) and the task genkeypair:

-genkeypair [-v] [-protected]

[- alias]

[- keyalg] [- keysize < taille_cle >]

[- sigalg] [- dname]

[- validity] [- keypass < mot_passe_cle >]

[- keystore] [- storepass < mot_passe_store >]

[- storetype] [- providername]

[- providerclass < provider_class_name > [-providerarg]]...

[- providerpath]

What gives:

keytool - genkeypair-v - keystore myReleaseKeystorePath.jks - storepass myKeystorePassword - alias myKey - keypass myKeyPassWord - keyalg RSA - validity 36500

Where:

  • myReleaseKeyStorePath is the full path to your KeyStore (/ home/myStores/myKeyStore.jks),
  • myKeystorePassword is the password of your KeyStore
  • myKey is the name of your key and
  • myKeyPassWord is the password for this key.

The system will ask you a series of questions: name, surname, organization,...



[1] don't forget not this Keystore must be secured and persistent, as well as his password.

[2] you will find the complete list here: http://en.wikipedia.org/wiki/ISO_3166-2

Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Affichage
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline