Giter Club home page Giter Club logo

reinforcer's Introduction

360加固助手自动加固插件

当前最新版本号:

介绍

  • 基于360加固宝的自动化加固的Gradle插件,可以在AndroidStudio执行完assembleRelease相关的任务结束后自动使用360加固宝进行加固apk文件,并输出至指定的文件目录下。
  • 支持WindowsMac OS以及Linux系统。
  • 支持多渠道打包。

安装方法

  1. 在android工程的根目录下build.gradle文件的适当位置添加以下代码:
buildscript {
    repositories {
        maven { url 'https://jitpack.io' }
    }
    dependencies {
        classpath 'cn.numeron:reinforcer:latest_version'
    }
}
  1. 在app模块的build.gradle文件的适当位置添加以下代码:
apply plugin: 'com.android.application'
//添加以下代码
apply plugin: 'reinforcer-plugin'

//此行代码添加到android节点以下
reinforcer {
    //执行完打包任务后是否加固,默认为是
    enabled = true
    //以下两项为必填项,否则无法运行加固功能
    outputDirectory = "apk文件输出目录"
    installationPath = "360加固助手的jiagu.jar包完整路径"
    //360加固助手的登录账号与密码,没有设置时,每次打包不进行登录操作,但是可能会加固失败。
    username = "账号"
    password = "密码"
    //默认情况下会读取android/buildTypes/release闭包下已配置的签名信息
    //配置参数为signingConfigs节点下其中之一的名称
    signConfigName = "signing config name"
    //默认情况下reinforcer加固后的文件名与项目中applicationVariants闭包下指定的文件名相同
    //可通过以下方式添加映射关系,当文件名(不包含扩展名)与key值匹配时,输出的文件名会修改为value的值
    rename += ["key1": "value1", "key2": "value2"]
}

使用方法

  • 启用reinforcer后,执行打包任务即可,如:gradlew app:assembleReleasegradlew app:assembel[渠道名]Release
  • 等待任务执行结束后,到输入apk输出目录获取加固后的文件。
  • 执行reinforce任务可以单独执行加固任务,需要指定inputApk作为参数,参考以下3种方式:
    • 通过命令行执行任务时,需要添加-PinputApk=[apk路径]作为参数。
    • 通过gradle列表执行时,需要在arguments中填入-PinputApk=[apk路径]
    • 或在app模块的build.gradle文件中添加以下代码指定要加固的apk文件后,直接运行reinforce任务即可。
      tasks.getByName("reinforce") {
          inputApk = "build/outputs/apk/release/application.apk"
      }

附录

  • 指定项目打包时apk文件名的方法:
android {
    applicationVariants.all { variant ->
        variant.outputs.all { output ->
            outputFileName = "打包后的apk包名.apk"
        }
    }
}
  • 设置打包后自动签名的信息:
android {
    signingConfigs {
        //release即此签名配置的名称
        release {
            keyAlias '...'
            keyPassword '...'
            storePassword '...'
            storeFile file("...")
        }
    }
    buildTypes {
        release {
            ...
            //指定打包时使用signingConfigs闭包下release的签名配置
            signingConfig signingConfigs.release
        }
    }
}

reinforcer's People

Contributors

xiazunyang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

reinforcer's Issues

JiaguHelper 加固报错!

2023-08-17 17:32:38 INFO JiaguHelper - ?????????????360??????????Э?顷????360????????????????360???????????, ???????????ü?????
2023-08-17 17:32:39 INFO JiaguHelper - ??????
2023-08-17 17:32:39 ERROR JiaguHelper - ?????????????, ??????????з??????????, ???????????????????

################################################

## # # ## ### ### ## ###

# # # # # # # # # # # #

### # # ### # # # ## #

# # ### ### # # # ### # # ###

Obfuscation by Allatori Obfuscator v8.5 DEMO

http://www.allatori.com

################################################

2023-08-17 17:32:50 ERROR JiaguHelper - ??????????????:org.apache.commons.cli.UnrecognizedOptionException: Unrecognized option: -importsign

################################################

## # # ## ### ### ## ###

# # # # # # # # # # # #

### # # ### # # # ## #

# # ### ### # # # ### # # ###

Obfuscation by Allatori Obfuscator v8.5 DEMO

http://www.allatori.com

################################################

2023-08-17 17:33:05 ERROR JiaguHelper - ????????????, ??????

【bug】inputApk无效

360加固apk路径不能太深,好像是256位字符,所以选择指定位置打包,在tasks.getByName("reinforce") {...}中设置inputApk无效,最终代码还是从变体的输出位置去取

【优化】变体(variant)找不到问题

如果在build脚本中变体名称有特殊符号比如:下划线 “_”,就会出现类似“variant XXX not found. reinforce termination.”的提示,因为特殊符号无大小写区别,导致找不到。也不能含有大写字母

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.