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

开启R8或者高版本的AGP开启minifyEnable后,btrace2.0插桩失败 #67

Open
ShurZhou opened this issue Jun 28, 2023 · 3 comments

Comments

@ShurZhou
Copy link

原因:看编译日志似乎是plugin没找到dexBuilder导致plugin没有正确的apply
企业微信截图_d48589e0-e0ea-4486-9156-0708f194d681

@mzule
Copy link
Collaborator

mzule commented Jun 29, 2023

7.0 的 AGP 吗,这个正在适配了,近期会发布。

@ShurZhou
Copy link
Author

7.0 的 AGP 吗,这个正在适配了,近期会发布。

不仅7.0的AGP开启minifyEnable会导致插桩失败

在4.1.0的AGP上开启R8也会导致插桩失败。你们这个仓库的demo就可以复现,将gradle.properties中android.enableR8改成true,然后编译,插桩并没有生效

@qiuqifan
Copy link

qiuqifan commented Aug 3, 2023

+1 ,碰到了跟楼主一样的问题。
AGP版本为4.1.0

没有完全打开r8,仅开启minifyEnable配置的情况下:
android.enableR8.fullMode=false
minifyEnabled true
shrinkResources true

搜了下,对应处理源码应该在 rhea-build/rhea-gradle-plugin/src/main/java/com/bytedance/rheatrace/plugin/internal/CopyMappingTask.kt 里面,仅判断了是否指定了enableR8属性,上述配置情况下,会走hookAssetsTask方法尝试hook dexbuilder,但开启minifyEnabled之后并不会dexbuilder task,导致hook 失败无法生成methodMapping文件。
val enableR8 = "false" != project.properties["android.enableR8"]
if (enableR8) {
hookAssetsTaskR8(variant, project, assetsDir)
} else {
hookAssetsTask(variant, project, assetsDir)
}

@mzule @ShurZhou

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