Skip to content

Latest commit

 

History

History
 
 

butterknife-check-plugin

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

English | 简体中文

Purpose

  Able to detect exceptions caused by cross-module use of ButterKnife during compilation

Problem

  When using ButterKnife across modules, if the following conditions are satisfied

  1. Class A is injected by ButterKnife
  2. Class B that is parent of Class A is also injected by ButterKnife
  3. A and B are in different modules

  Under the condition that instance of A uses ButterKnife injection, the injection of the parent class B will be ignored, which may cause a null pointer exception or a potential business logic exception
  This plugin hopes to check this situation during compilation. If an abnormal case is detected, the compilation process will be interrupted, and an error message will be output to propel the developer to fix it.

TODO

  Automatic repair for wrong cases with bytecode technology

Quick Start

  • add build classpath

    classpath "com.bytedance.android.byteX:butterknife-check-plugin:${plugin_version}"

  • apply and configure the plugin in your build.gradle(application)

    apply plugin: 'bytex.butterknife-check'
    butterknife-check-plugin {
        enable true
        enableInDebug true
        logLevel "DEBUG"
    }