A. Configure the Build.gradle script file to add the following to the Android node:
Signingconfigs {
Config {
StoreFile file (' e:/ipc/packaging related/signature/ivy-app.keystore ')
Keypassword ' Landinghome2014ivy '
Keyalias ' Ivy '
Storepassword ' Landinghome2014ivy '
}
}
Buildtypes {debug {
Debuggable true
Signingconfig Signingconfigs.config
}
Release {
Minifyenabled false
Proguardfiles getdefaultproguardfile (' proguard-android.txt '), ' Proguard-rules.pro '
Signingconfig Signingconfigs.config
}
}
B. Enter the command in the Terminal command line panel:
Gradlew clean//Empty the previous build directory
Gradlew Build//Rebuild project and build four apk when finished
Note: If you do not want to enter the signature key in the configuration file, you can do so as follows:
A custom method to get the secret key string by typing from the console:
def GetPassword () {
System. Console (). printf ("\ n Please enter the signature file key: \ n")
Return System. Console (). ReadLine ()
}
b then modify the value of the signature password in the signature configuration
Signingconfigs {
Config {
StoreFile file (' e:/ipc/packaging related/signature/ivy-app.keystore ')
Keypassword GetPassword ()
Keyalias ' Ivy '
Storepassword GetPassword ()
}
}
C Finally, as with the previous apk, enter the command at the command line:
Gradlew Clean
Gradlew Build
will prompt for a signature secret key
D after entering the password, wait for the run to complete to generate APK
Android Studio Signature