-
-
Notifications
You must be signed in to change notification settings - Fork 282
Startup phase: build up the project
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.
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
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.