• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

CoXier/AppMethodTracking: A gradle plugin tracking android application method

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

CoXier/AppMethodTracking

开源软件地址(OpenSource Url):

https://github.com/CoXier/AppMethodTracking

开源编程语言(OpenSource Language):

Groovy 99.2%

开源软件介绍(OpenSource Introduction):

Method Tracking

building

A plugin to display how methods are called in application.

Live Demo

Usage

Stpe1

Add these to your root build.gradle.

buildscript {
  repositories {
    maven {
      url "https://plugins.gradle.org/m2/"
    }
  }
  dependencies {
    classpath "gradle.plugin.com.uniquestudio:method-tracking:1.0.6"
  }
}

Don't forget :

apply plugin: "com.uniquestudio.method-tracking"

Step2

First find where you want to debug.In my demo I care about how to wear cloth,so I add two lines around wearCloth like this:

Debug.startMethodTracing(getPackageName());
wearCloth();
Debug.stopMethodTracing();

public void wearCloth() {
    putOnCoat();
    putOnPants();
    putOnShoes();
    putOnHat();
}


private void putOnPants() {

}

private void putOnCoat() {

}

private void putOnHat() {
    // Put on hat
}


public void putOnShoes() {
    putOnSocks();
    // Put on shoes
}

public void putOnSocks() {
    // Put on socks
}

Step3

Now let's start configure this plugin.In your app module, add method-tracking closure.

methodTracking{
    traceName = 'com.hackerli.sample.trace'
    filterList = ['com.hackerli.sample']
}
  • traceName is from the method Debug.startMethodTracing(traceName)
  • filterList is used to filter some extra methods.We usually use package name.

Step4

./gradlew track

After above steps,traceName.html is created.

Its output like this:

The digit is useces.

In html,I add click event that means you can toggle these elements that have children.For example if I click com.hackerli.sample.MainActivity.putOnShoes above line,I will get:

THANKS

I am inspired by AppMethodOrder,espically how to compatible Windows os in groovy script or gradle script.

LICENSE

Copyright 2017 coxier.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.



鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap