lancet
lancet copied to clipboard
A lightweight and fast AOP framework for Android App and SDK developers
项目地址:https://github.com/Knight-ZXW/LancetX
如android原生View存在以下方法: ``` /** {@hide} */ @CallSuper protected void encodeProperties(@NonNull ViewHierarchyEncoder stream) { // ...... } ``` 其传入参数 ViewHierarchyEncoder 也存在@hide注解 而我写了以下方法均不生效 ``` @Insert(value = "encodeProperties") @TargetClass(value = "android.view.View") protected void _encodeProperties(ViewHierarchyEncoder...
代码见 https://github.com/liujianAndroid/lancet 使用方式如下 repositories { mavenCentral() } classpath 'com.bytedance.tools.lancet:lancet-plugin-asm6:1.0.0'
想对ContentProvider的创建时间进行拦截,然后一直不成功 
lancet支持在应用中hook ActivityManagerService中的方法吗,比如 @Proxy("handleApplicationCrash") @TargetClass("com.android.server.am.ActivityManagerService ") public void handleApplicationCrash(IBinder app, ApplicationErrorReport.CrashInfo crashInfo){ Log.v("handleApplicationCrash", JSON.toJSONString(crashInfo)); Origin.callVoid(); }
Lancet版本:1.0.5 FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':App:transformClassesWithLancetForDemoRelease'. > java.lang.ClassCastException: me.ele.lancet.weaver.internal.graph.ClassNode cannot be cast to me.ele.lancet.weaver.internal.graph.InterfaceNode
  这种情况就无法实现。
version:1.0.6 code: @Proxy("enqueueMessage") @TargetClass("android.os.MessageQueue") protected Boolean test(Message msg, long delayMillis){ Log.d("enqueueMessage","testssss",new Exception()); return (Boolean) Origin.call(); }
项目配置: gradle版本:com.android.tools.build:gradle:4.0.0 使用插件:com.bytedance.tools.lancet:lancet-plugin-asm6:1.0.0 库版本:implementation 'me.ele:lancet-base:1.0.6' 问题 1. 当修改一个xml布局文件,修改样式等,重新编译运行,发现出来的效果是修改前的。移除lancet使用后,发现恢复正常 2. 使用此插件之后,debug代码,发现断点各种异常。比如:单步调试时,代码的执行流程和原有的代码执行流程对不上。初步怀疑因为代码插装的缘故,到时断点的位置不正确,别插入的代码影响到了
Android gradle 版本号: classpath 'com.android.tools.build:gradle:3.6.3' distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip AndroidX 编译报错