Code Monkey home page Code Monkey logo

obfuscator-plugin's Introduction

混淆小助手的使用方式

一. 引入插件

1. 在build.gradle配置依赖

buildscript {
    repositories {
        jcenter()
        //1. 加入Jitpack仓库
        maven { url 'https://jitpack.io' }
    }
    dependencies {
        ...
        //2. 加入obfuscator-plugin 插件  
        classpath 'com.github.helen-x:obfuscator-plugin:1.0'
    }
}

2. build.gradle 使用plugin

//使用混淆插件  
apply plugin: 'obfuscator-plugin'

引入完毕后,就可以直接使用啦.

二. 使用方法:

场景1:类中所有public成员不混淆(不包括内部类)

@ObfuscateKeepPublic
public class TestAnnotationKeepPublic{
}

场景2:类中所有成员不混淆(不包括内部类)(内部类如果不需要混淆也要加入此注释)

@ObfuscateKeepAll
public class TestAnnotationKeepAll {
}

场景3:保留所有实现IObfuscateKeepAll接口的类,(注意接口有传递性,他的子类也会被keep)(内部类如果没有继承此接口会被混淆)

public class TestInterfaceKeep implements IObfuscateKeepAll{
}

场景4:保留带注释的成员,适用于类和内部类

public class TestAnnotationKeepThisField {
    
    public String sName;
    public static String sSName;
    private int iValue;
    
    @ObfuscateKeepThisField
    private static int iSValue;
    
    @ObfuscateKeepThisField
    private void tFunc(){
    }
}

场景5:保留类中set/get/is函数

@ObfuscateKeepSetterGetter
public class TestAnnotationKeepSetterGetter {}

obfuscator-plugin's People

Contributors

helen-x 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.