Last Updated on
Today writing this article to describe building signed apk file to publish on appstore.
this the most important point when you are ready to release your application for user or appstore. For Example google play store, other apps store. only signed apps are accepted.
The Android system requires that all installed applications be digitally signed with a certificate whose private key is held by the application’s developer.
The Android system uses the certificate as a means of identifying the author of an application and establishing trust relationships between applications.
The certificate is not used to control which applications the user can install. More Details
Using Gradle.Build File :
AndroidStudio is alpha version for now. So you have to edit gradle build script files by yourself. Add next lines to your build.gradle
To actually run your application at emulator or device run gradle installDebug or gradle installRelease.
Version Control Setting
To Configure your apk version configuration use flowing
Using Ant Build :
This Process are pretty easy for building signed apk .If you are using Ant, you can enable release mode by using the release option with the ant command Line Interface.
For example, if you are running Ant from the directory containing your build.xml file, the command would look like this:
$ ant release
First we need to insure placing proper file in our project directory.if you create project in command Line Interface than both file are auto mated create in project property.
Before run ant build place this ant.properties & build.xml
Run android update project -p .
Create ant.properties file manually with the following contents
Tell ant where your keystore file :
Now you just need to tell ant where the keystore file is by going to your android project folder (For phonegap it’s in platforms/android) and create an ant.
properties file and put the following in it:
Where key.store equals the path to the keystore file starting at the C Drive if you’re on windows and it’s a relative path starting from the location of the ant.
properties file if you’re on mac (example: key.store=../../../../my-apps-release-key.keystore), and key.Alias is whatever you setup when you created the keystore.
Build With PhoneGap:
Open up the command prompt, and navigate to your project and run phonegap build.
In platforms/android/bin you should have:
Build Using Android Studio:
On the main menu, choose Build | Generate Signed APK. The Generate Signed APK Wizard starts.
To have the package signed with a key from a previously generated keystore file:
Specify the file location in the Keystore path text box. Type the path manually or click the Choose existing button and choose the file in the dialog that opens.
Specify the key alias and the password to access the key.
To have a new key generated in an existing keystore:
- Specify the keystore location and password in the Keystore path and the Password text boxes respectively.
- Click the Create new button. In the New Key Store dialog box that opens, specify the location of the file to be generated in the Key store path text box. Type the path manually or click the Browse button , then select the parent folder and specify the name of the file.
- Specify and confirm the password to access the keystore.
- Configure the release key to be generated by filling in the data in the Key area. The procedure is identical no matter whether you are using a wizard or an artifact definition, see Generating a Signed Release APK Using a Wizard: Generating a new release key for details.
- Click OK when ready. IntelliJ IDEA brings you back to the first page of the wizard, where the keystore location, the key alias and passwords to access them are filled in in the corresponding fields.
- In the Destination APK path text box, specify the folder to store the package .apk file in. Type the path manually or click the Browsebutton and select the package output folder in the Choose destination APK file dialog box that opens.
- To have IntelliJ IDEA obfuscate the application during packaging, select the Run ProGuard check box and specify the location of the proguard.txt configuration file. The file is generated during project creation and is stored in the project root. IntelliJ IDEA suggests this default location in the Config file path text box. Accept the suggestion or specify a custom configuration file by clicking the Browse button and selecting the required file in the dialog that opens.
- Click Finish to have the package generated and signed. When the package is generated, IntelliJ IDEA informs you about it in an information message.To open the folder where the generated .apk file is stored, click the Open File Location button.
To leave the wizard, click Close.