Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

method-call-opt-plugin根本就没效果 #143

Open
ikakaxi opened this issue Apr 29, 2022 · 2 comments
Open

method-call-opt-plugin根本就没效果 #143

ikakaxi opened this issue Apr 29, 2022 · 2 comments

Comments

@ikakaxi
Copy link

ikakaxi commented Apr 29, 2022

class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        findViewById<Button>(R.id.button).setOnClickListener {
            Log.e("TAG","aaaa")
        }
    }
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
// apply ByteX宿主
apply plugin: 'bytex'
ByteX {
    enable true
    enableInDebug false
    logLevel "DEBUG"
}
// 按需apply bytex 插件
apply plugin: 'bytex.refer_check'
apply plugin: 'bytex.method_call_opt'
method_call_opt {
    enable true
    //建议开发模式关闭
    enableInDebug true
    logLevel "DEBUG"
    //是否在log中显示删除方法调用指令后的方法指令,一般调试时使用
    showAfterOptInsLog false
    //需要删除的方法配置
    methodList = [
            //下面的每一项配置必须严格按照数据配置,一个地方不对这一项不生效。
            //class#method#desc
            "android/util/Log#v#(Ljava/lang/String;Ljava/lang/String;)I",
            "android/util/Log#v#(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I",
            "android/util/Log#d#(Ljava/lang/String;Ljava/lang/String;)I",
            "android/util/Log#d#(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I",
            "android/util/Log#i#(Ljava/lang/String;Ljava/lang/String;)I",
            "android/util/Log#i#(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I",
            "android/util/Log#w#(Ljava/lang/String;Ljava/lang/String;)I",
            "android/util/Log#w#(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I",
            "android/util/Log#e#(Ljava/lang/String;Ljava/lang/String;)I",
            "android/util/Log#e#(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I",
            "android/util/Log#println#(ILjava/lang/String;Ljava/lang/String;)I",

            "java/lang/Throwable#printStackTrace#()V",
            "com/google/devtools/build/android/desugar/runtime/ThrowableExtension#printStackTrace#(Ljava/lang/Throwable;)V"

            //还有自己项目中封装的Logger方法
    ]
    onlyCheckList = [
            //"com/ss/*",
            //"com/bytedance/*"
    ]

    whiteList = [
            "com/facebook/stetho*",
    ]
}

根本没效果,点击按钮仍然输出日志

@myxh
Copy link

myxh commented Jun 20, 2022

我也是,是不是对Kotlin无效啊

@TellH
Copy link
Collaborator

TellH commented Sep 29, 2022

@ikakaxi 你是用debug包试的吗,我看你的配置里

ByteX {
    enable true
    enableInDebug false
    logLevel "DEBUG"
}

enableInDebug = false ,你改成true试试?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants