Tuesday, February 28, 2023

How to create a keystore for signed apk in android and flutter

You must add a digital signature to your software in order to share it on the Play Market. Follow these steps to submit your application.

Deployment and upload are the two types of authentication credentials available on Android. The.apk file authenticated with the "deployment key" is downloaded by the end consumers. The.aab/.apk files that developers submit to the Play Store are authenticated using a "upload key" and are then re-signed using the distribution key after being accepted. 

Using the command line, execute the following:

Use the following command on Mac or Linux:.

  keytool -genkey -v -keystore ~/upload-keystore.jks -keyalg RSA -keysize 2048 -validity 10000 -alias upload




Use the following instruction on Windows:

  keytool -genkey -v -keystore %userprofile%\upload-keystore.jks -storetype JKS -keyalg RSA -keysize 2048 -validity 10000 -alias upload


The upload-keystore.jks file is kept in your personal directory by this programme. Change the argument you give to the -keystore option if you want to store it somewhere else. But don't put the keystore file into public source control; keep it secret!

Saturday, February 25, 2023

How to change package name in flutter

In some cases, for the android application it may be required to change the package name of the application. It's very easy to do it in Android studio. But when we are using flutter to develop the hybrid application, it is required to use some packages to do this job for us.

To achieve this we have to download a package : change_package_name. It does all the below changes:

  • Update AndroidManifest.xml files for release, debug & profile
  • Update build.gradle file
  • Update MainActivity file. Both java & kotlin supported.
  • Move MainActivity file to new package directory structure.
  • Delete old package name directory structure.
We can use this package as below:

First we need to add this package name to pubspec.yaml file as the dev_dependency

dev_dependencies: 
  change_app_package_name: ^1.1.0

Not migrated to null safety yet? use old version like this

dev_dependencies: 
  change_app_package_name: ^0.1.3
You can see this how i have added  it to my pubspec.yaml file


Save this file and Run the below command :

flutter pub get


And it gets all the dependencies. and now using this package we need to change the application's package name. Now run the below command to change the package name

flutter pub run change_app_package_name:main com.new.package.name
com.new.package.name is the new package name to be changed. 

This will automatically updates all the required package name and it's references moves all the required files to the new package And deletes the new package name directory structure.

That's all. Happy coding..