Giter VIP home page Giter VIP logo

freeproguard's Introduction

logo

fpg License

About

FreeProGuard 为方便广大 Android 开发者们今后防混淆配置,很久之前便有打算做这个免混淆库了,只是拖到最近才有空来实现该库,该库利用了 consumerProguardFiles 来传递 aar 中的防混淆配置到主工程中,所以依赖了该库后常用的主流三方库便不再需要开发者们手动配置了,当然,有些友善的库已采用了该方式,我也希望更多的开源库使用该方式从而省去开发者配置防混淆,本库已配置了如下防混淆文件(包括库的不同版本):

How to use

  1. 首先开启混淆,设置 minifyEnabled true
  2. 添加依赖:
    implementation "com.blankj:free-proguard:0.0.8"
  3. 把项目中的实体类加入到 proguard-rules.pro 文件中,一般为 -keep class urpackage.xx.bean/entity/model.** { *; },或者使用 @Keep 注解这些实体类;
  4. 把项目中需要防混淆的 jar 加入到 proguard-rules.pro 文件中,比如支付宝 SDK 的 -libraryjars libs/alipaySDK-20150602.jar,如果要对所有 jar 都防混,那么使用 -libraryjars libs 即可;
  5. 把项目中用到的一些不包括在如上列表中的三方库配置到 proguard-rules.pro 文件中,或者提 issue 使其加入到本库中来(小众或者冷门的不予合入哦)。

Profit

  1. 开启混淆会将代码中的所有变量、函数、类的名称变为简短的英文字母代号(也可自定义),在缺乏相应的函数名和程序注释的情况下,即使被反编译,也将难以阅读,提升应用的安全性;
  2. 混淆通过分析字节码,去掉冗余代码,再加上缩短了变量、函数、类的名称,可以进一步缩减应用大小,如果想混淆资源文件,可以使用微信的 AndResGuard

Last but not least

如果该库能为你节省 10 分钟甚至更多的时间,请把它分享给他人来帮助更多的开发者们节省时间,这些时间可以多陪伴家人、多运动、多做自己喜欢的事情,希望开源可以帮助到更多的人,也希望更多的人加入到开源中来。

freeproguard's People

Contributors

blankj avatar

Watchers

xiangyutian avatar

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.