Cognic Systems

How to Generate APK

As an Android developer, you may need to generate an apk or aab file at some point in your development process. An apk file is the package file format used to distribute and install apps on Android devices, while an aab file (Android App Bundle) is a new format introduced by Google to improve the app delivery process. In this article, we will provide a step-by-step guide for generating both apk and aab files. Whether you are looking to publish your app to the Google Play Store or simply want to test it on your own device, these instructions will help you create the necessary files.

To change the name of your app, follow these steps:

  • Open Explorer in VsCode and navigate to the package.json file.
  • Add the desired name for your project.
  • Go to the folder Android => app => src => main => res => values => Strings.xml.
  • Open the Strings.xml file and update the name of your app.

For example, if you want to name your app “Project,” you would follow these steps and update the name in the Strings.xml file.”

2. To add the icon to App , one can use appicon.co To generate the icons for app. After downloading .zip file from appicon.co replace the files in folder Android => app => src => main => res with the files in .zip file.

 

3. Now to Add private signing keys , Go to android => app directory
keytool -genkeypair -v -storetype PKCS12 -keystore my-upload-key.keystore -alias my-key-alias -keyalg RSA -keysize 2048 -validity 10000
please change the name of -keystore and -alias name as desired and add the keystore Password.

4. As a result of executing the above command we will be asked for the key details that we going to enter in.

5. Now we can see the key file generated in the app folder named Yourkeyfilename.keystore.

Next To add the gradle variables go to android => gradel=>gradel.properties

add the following lines at last line of page.

MYAPP_UPLOAD_STORE_FILE=my-u
MYAPP_UPLOAD_KEY_ALIAS=my-key-alias
MYAPP_UPLOAD_STORE_PASSWORD=*****
MYAPP_UPLOAD_KEY_PASSWORD=*****

Don’t forget to Replace the UPLOAD_STORE_FILE name with your. keystore file name.
, UPLOAD_KEY_ALIAS name with your alias name and add UPLOAD_STORE_PASSWORD
and UPLOAD_KEY_PASSWORD.

6. Last configuration step that needs to be done is to setup release builds to be signed using upload key. Edit the file android=>app=>build.gradle in your project folder, and add the signing config, Add the following to SigningConfigs Object.

release {
if (project.hasProperty(‘MYAPP_UPLOAD_STORE_FILE’)) {
storeFile file(MYAPP_UPLOAD_STORE_FILE)
storePassword MYAPP_UPLOAD_STORE_PASSWORD
keyAlias MYAPP_UPLOAD_KEY_ALIAS
keyPassword MYAPP_UPLOAD_KEY_PASSWORD
}

}

and change the buildTypes object to
buildTypes {
release {

signingConfig signingConfigs.release
}
}

7. Now to generate .aab files go to the android folder and run the following command in the command line.
./gradlew bundleRelease
now wait for some time until the VsCode Terminal Displays Build Sucessfull Message.

8. After getting the build successful message go to folder android=>app=>build=>outputs=>bundle=>release. finally, we will get .aab file.

9. Now for generating .apk file steps from 1 to 8 are same, to generate apk go to the folder android and run the following command in Vscode Terminal.
./gradlew assmebleRelease
wait until build succesfull message is displayed in Vscode terminal. After build successful message is displayed go to folder android=>app=>build=>outputs=>apk=>release .
We will get generated .apk File.
Upload Your Android App Bundle Release File to Google Play console

10. login to your google play console goes to the dashboard click on all apps. Your all previously uploaded apps will be listed here, click on the app wish to upload the new release

 

12. Now, in left panel click on Release then go to Release=>Internal Testing, click on Create Release button,

Click on Create New Release, upload the .aab file , then this testing release will be available for internal testers.

Written By 

Kapil ( System Analyst-Mobile app development team)

Leave a Reply

Looking for a First-Class Business Plan Consultant?