Android requires that all apps install digital certificates before they are installed. Android uses a digital certificate to determine the author of the app, which does not require a certificate authority to sign. The Android app often uses self-signed certificates. The app developer holds the private key for the certificate.
Signingoverview
You can sign an app in debug mode or Release mode two ways. You can develop in debug mode and publish in release mode. The Android SDK generates a signing certificate in debug mode. To sign an APK under release mode, you need to generate your own certificate.
Signing in Debug Mode
In debug mode, the certificate used by the signature apk is generated by Android SDK tools. The certificate has a private key with a known password, so that you do not need to enter a password each time you run and debug the application.
When you debug your project at run or, Android Studio will automatically sign your app in debug mode.
Under DebugMode, you can run a debug app on a virtual machine or device, but you can't publish it.
By default, the debug mode configuration uses a debug KeyStore (KeyStore) with a known password and a known default key. This debug KeyStore is located in the $HOME/.android/debug.keystoreand is automatically created during compilation if the file does not exist. This debugbuild type is SigningConfig automatically configured by Debug.
Signing in Release Mode
In release mode, the signature app should use your own certificate.
1. Create a keystore. A keystore is a binary file that contains private key, you should put this file in a safe and secure place.
2. Create a private key. Private key represents an entity that is equivalent to an app. For example, a person or a company.
3. Add signature configuration to the app module modules.
...
Android{
...
Defaultconfig{ ... }
Signingconfigs{
Release{
StoreFile file("Myreleasekey.keystore")
Storepassword"Password"
Keyalias"Myreleasekey"
Keypassword"Password"
}
}
Buildtypes{
Release{
...
Signingconfig Signingconfigs.Release
}
}
}
...
5. Perform assemblerelease compilation tasks.
Generated signature apk in app/build/apk/app-release.apk
  author has words: If you need android Chinese API, please sweep the following QR code, do the technology, we are serious.
Android Chinese api:signing Your applications (for APK signature)