I hope this article will be helpful for you to understand how to sign the apk file.
It is always important to sign the apk before we release it for production to make your app a secured one. We are going to see here how to
- Wrap and Sign APK for Intune
- Sign APK for App Center
For both Intune and App Center, we need Java Key Store.
Create Java Key Store
Java key store (.jks file) to protect the app with a password.
To create a key store, open the Android studio
Step 1: Go to build and click “Generate signed bundle/APK”.
Step 2: Choose APK and click “Next”
Step 3: Click on Create new
Step 4: Browse to the path where you need to create a .jks file.
Provide a file name, and click OK.
Step 5: Fill in all the required details and click OK.
Note: Remember Key Alias name, Key Store and Key Alias password.
Step 6: Now you could see your JKS file generated in the selected folder.
Wrapping and signing APK for Intune.
Download and install the Intune App Wrapping Tool for Android
Click on the below link to download the .exe file and install the Intune App Wrapping Tool
Step 1: Open the powershell,go to the below directory where you installed your Intune wrapping tool and execute the below command.
Directory: C:\Program Files (x86)\Microsoft Intune Mobile Application Management\Android\App Wrapping Tool
Command: Import-Module ‘C:\Program Files (x86)\Microsoft Intune Mobile Application Management\Android\App Wrapping Tool\IntuneAppWrappingTool.psm1’
Step 2: Once a required module is installed lets wrap the application with the below command in the same directory as Step 1.
Invoke-AppWrappingTool -InputPath G:\Hema\Sample.apk -OutputPath G:\Hema\SampleOut.apk -KeyStorePath C:\JksFile\Key.jks -keyAlias KeyAlias
Input APK Path – G:\Hema\Sample.apk
Wrapped APK Path – G:\Hema\SampleOut.apk – Give your own path and APK name.
KeyStore Path – C:\JksFile\Key.jks
You will be prompted to provide Key Store Password and Key Alias Password. Enter both password and Click “Enter”
Step 3: Now it’s time to create the signed APK. Go to the jdk bin directory to execute the command.
Directory: C:\Program Files\Java\jdk1.8.0_191\bin
Command: ./jarsigner -verbose -keystore G:\Hema\Key.jks G:\Hema\SampleOut-unsigned.apk KeyAlias
Signing APK for App Center
Step 1: In Android Studio, File –> New –> Import Project.
Step 2: Select Android platform from the hybrid Application for which you need to create signed APK and Hit OK.
Step 3: New window will be opened with your imported project, Now Go to Build –> Generate Signed bundle/ APK.
Step 4: Choose “APK” and click “Next”
Step 5: Create a new Keystore or choose an existing if already created. Provide Key Alias Name, Key store password and Alias Password which was set while creating Key Store and click “Next”
Step 6: Give the destination folder path where you want to generate signed APK, then click release, select required versions and Click “Finish”
In this blog post, We have learnt how to generate Java Key Store, Wrapping and signing APK with Intune wrapping tool and creating signed APK in android Studio.
Suggestions are welcome