360 Hardening assistant automatic hardening plug-in

Open source address: Github

introduce

  • The Gradle plugin automatically installs installs of assembleRelease files in AndroidStudio. This plugin automatically installs installs of assembleRelease files in AndroidStudio.

  • Support multi-channel packaging.

Installation method

  1. Add the following code in the appropriate location of the build.gradle file in the root directory of the Android project:
buildscript {
    repositories {
        maven { url 'https://jitpack.io' }
    }
    dependencies {
        classpath 'cn.numeron:reinforcer:latest_version'}}Copy the code
  1. Add the following code in the appropriate place of your app module’s build.gradle file:
apply plugin: 'com.android.application'
// Add the following code
apply plugin: 'reinforcer-plugin'

// Add this line of code below the Android node
reinforcer {
    // Whether to enable the reinforcer
    enabled = true
    // The following two items are mandatory. Otherwise, the hardening function cannot be run
    outputDirectory = Apk file output directory
    installationPath = "Full path to 360 Ruggedize Assistant jiagu.jar package"
    If the login account and password of 360 Hardening Assistant are not set, the login operation is not performed each time the hardening assistant is packaged
    username = "Account"
    password = "Password"
    / / by default will read android/buildTypes/release under the closure has the signature of the configuration information
    // The configuration parameter is the name of one of the signingConfigs nodes
    signConfigName = "signing config name"
    The file name that is reinforced by default is the same as the one specified under the applicationVariants closure of the project
    If the file name (excluding the extension name) matches the key value, the output file name is changed to the value of value
    rename += ["key1": "value1"."key2": "value2"]}Copy the code

Method of use

  • Perform packaging tasks, such as:gradlew app:assembleReleaseorGradlew app: Assembel [channel name]Release
  • After the task is complete, obtain the hardened file from the input APK output directory.

The appendix

  • Method for specifying apK file names for project packaging:
android {
    applicationVariants.all { variant ->
        variant.outputs.all { output ->
            outputFileName = "Name of packaged APK package. Apk"}}}Copy the code
  • Set the information for automatic signature after packaging:
android {
    signingConfigs {
        // Release is the name of this signature configuration
        release {
            keyAlias '... '
            keyPassword '... '
            storePassword '... '
            storeFile file("...")
        }
    }
    buildTypes {
        release {
            ...
            // Specify the signature configuration to use release under the signingConfigs closure when packaging
            signingConfig signingConfigs.release
        }
    }
}
Copy the code