-
-
Notifications
You must be signed in to change notification settings - Fork 300
Startup phase: build up the project
Firstly, you may want to clone the subrepository 'libraries/openpgp-api-lib'.
In order to do this, you should run the following commands:
-
$ git submodule init
$ git submodule update
This will download the latest OpenKeyChain sources in your sources directory.
From now following, we use the so called Gradle Wrapper, that is a shell script (or a batch for windows users) that wraps the Gradle System used to build and manage the project.
NOTE: To execute the Gradle Wrapper you must be located in the root of the source tree, running always the program "gradlew" and optionally the command specified in the instructions
After download has completed, you should run the Gradle Wrapper without parameters in order to initialize the gradle structure.
This is achieved by running the following command in the root of your sources:
$ ./gradlew
Now, once you have initialized your sources, you can either contribute to the project or build up a release package.
In order to build a release apk, you should run the Gradle Wrapper with the command assembleRelease as following:
$ ./gradlew assembleRelease
This should build the unsigned apk, that you can find in 'app/build/outputs/apk/app-release-unsigned.apk'. Once it is a release version, you should now sign your apk in order to install it to your device and/or redistribute it.
-
Create a Signing Key (Optional) If you haven't done yet, you must create your signing key, that will be used to sign the apk. To create a signing key you must run the command below (please refer to the Android Documentation to get help on the keytool options and usage) in the folder that will be the container for your key (hopefully not the source tree):
$ mkdir ~/<my-release-key-store> # Where the symbol '~' (tilde) means your Home directory
$ cd ~/<my-release-key-store>
$ keytool -genkey -v -keystore <my-release-key>.keystore -alias <alias_name> -keyalg RSA -keysize 2048 -validity 10000
-
Sign the APK In order to sign the APK you should go to the directory that contains the release unsigned APK and run the jarsigner command:
$ cd <source-root>/app/build/outputs/apk
$ jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore <my-release-key>.keystore app-release-unsigned.apk <alias_name>
Please note that my-release-key and alias_name should be the same of the Signing Key, so please annotate them