Android Chinese api:signing Your applications (for APK signature)

Source: Internet
Author: User


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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.