Giter Site home page Giter Site logo

ooftf / spy Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 177 KB

在Build项目时检查Class之间的引用关系,避免因为依赖库版本问题而产生的ClassNotFoundException,NoSuchMethodException问题

Kotlin 8.77% Groovy 91.23%
apiinspect classnotfoundexception android gradle nosuchmethodexception

spy's Introduction

Spy

在Build项目时检查Class之间的引用关系,避免因为依赖库版本问题而产生的ClassNotFoundException问题
本项目借鉴于https://github.com/Sunzxyong/ApiInspect 修改内容如下

  • 增加了检测范围;
  • 支持className occurClassName method LineNumber多条件过滤
  • 修改为Referenced方式,不再Copy文件
  • 优化了兼容性问题;
  • 添加了interruptBuild属性,可选择打断Build过程

Maven Central

Introduce

Usage

Installation

Add dependencies in build.gradle of the root project

    repositories {
        mavenCentral()
   
    }
    dependencies {
        // ...
        classpath('com.github.ooftf:spy-plugin:1.0.5') {
            exclude group: 'com.android.tools.build', module: 'gradle'
        }
    }

and add the apply plugin to build.gradle in the module:

apply plugin: 'ooftf-spy'

Configuration

By default, spy will inspects all apis but does not contain the system api. Of course, you can also customize exclude or include Settings:

spy {

    enable true //Whether api inspect is enabled.

    inspectSystemApi false //Whether to inspect the system api.
    interruptBuild true //Whether interrupt build when find error
    //Specify the library to inspect.
//    include {
//        //Value is the package name.
//        api "com.zxy.tiny"
//    }

    //Specify the library not to inspect.
       /*exclude {
        //Value is the package name.
        api 'com.taobao.'
        api 'com.alibaba.'
        api 'org.'
        api 'com.baidubce.'
        api 'com.heytap.'
        api 'com.meizu.'
        api 'com.huawei.'
        api 'com.google.'
        api 'com.vivo.'
        api 'edu.umd.cs.findbugs.annotations.SuppressFBWarnings'
        api 'com.squareup.picasso.'
        api 'com.alipay.'
        api 'dalvik.'
        api 'sun.nio.'
        api 'okhttp3.internal.annotations.EverythingIsNonNull'
        api 'com.nostra13.universalimageloader.','com.didichuxing.doraemonkit'
        api 'com.tencent.map.geolocation.','com.didichuxing.doraemonkit'
    }*/

}

刚刚添spy可能报错比较多不要慌,一步步配置exclude即可,  
首先根据报错信息找到对应的类,如果对应位置有try catch处理这些一般可以添加到exclude
还有一些是不会运行到的类也可以添加到exclude

Inspect Result

When the Apk build is completed. The results of the inspection will be printed on the console:

Of course, The results of the inspection will also be stored in the api-inspect directory:

spy's People

Contributors

ooftf avatar

Stargazers

 avatar  avatar

Watchers

 avatar  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.