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

打包报错,BuildException报错8个jar包 #140

Open
withoutbuff opened this issue Oct 11, 2024 · 4 comments
Open

打包报错,BuildException报错8个jar包 #140

withoutbuff opened this issue Oct 11, 2024 · 4 comments

Comments

@withoutbuff
Copy link

我屏蔽其中一个包名,对应的jar报错会消失,但是我屏蔽所有的包名,只有最后一个生效,也就是说只有最后一个jar包的报错信息消失了。

btrace版本2.0.3-rc03
jdk1.8

-blockpackage com/airbnb/lottie/LottieTask
-blockpackage androidx/exifinterface/media/ExifInterface
-blockpackage com/tencent/tinker/android/dex/Dex
-blockpackage com/android/multidex/MainDexListBuilder
为什么我配置多个屏蔽项目,只有最后一个有用?

有8个类似下发的报错
org.gradle.tooling.BuildException: Failed to process: C:\Users\fionn.zhang\AndroidStudioProjects\n1904\app\build\intermediates\transforms\rheaTrace\overseaFour\debug\29.jar

@withoutbuff
Copy link
Author

private fun parseTraceFilterFile(processor: MappingCollector) {
var methodKeepStr = DEFAULT_BLOCK_PACKAGES
if (traceFilterFilePath != null && File(traceFilterFilePath!!).exists()) {
methodKeepStr += FileUtil.readFileAsString(traceFilterFilePath)
}
val methodKeepArray =
methodKeepStr.trim { it <= ' ' }.replace("/", ".").split("\n").toTypedArray()
val iterator = methodKeepArray.iterator()
loop@ while (iterator.hasNext()) {
val item = iterator.next()
when {
item.isEmpty() || item.startsWith("#") || item.startsWith("[") -> {
continue@loop
}
item.startsWith("-defaultblockpackage ") -> {
val packageName = item.replace("-defaultblockpackage ", "")
defaultBlockPackages.add(packageName)
}
item.startsWith("-blockpackage ") -> {
val blockPackageString = item.replace("-blockpackage ", "")
blockPackages.add(blockPackageString)
}
item.startsWith("-allowpackage ") -> {
val packageName = item.replace("-allowpackage ", "")
allowPackages.add(packageName)
}
item.startsWith("-blockclassmethods ") -> {
val className = item.replace("-blockclassmethods ", "").replace("{", "").trim()
while (iterator.hasNext()) {
val methodItem = iterator.next().split(";").first().replace(" ", "")
if (methodItem == "}") {
continue@loop
}
blockMethodSet.add("$className.$methodItem")
}
}
item.startsWith("-allowclassmethodswithparametervalues ") -> {
val className = item.replace("-allowclassmethodswithparametervalues ", "").replace("{", "").trim()
while (iterator.hasNext()) {
val methodItem = iterator.next().split(";").first().replace(" ", "")
if (methodItem == "}") {
continue@loop
}
formatClassMethodsWithParam(className, methodItem)
}
}
item.startsWith("-traceclass ") -> {
val traceClass = item.replace("-traceclass ", "")
traceClassSet.add(traceClass)
}
item.startsWith("-traceclassmethods ") -> {
val classInfoItems = item.replace("-traceclassmethods ", "").replace("{", "").trim().split(" ")
var className = ""
var superClassName = ""
if (classInfoItems.size == 3) {
if (classInfoItems[1] != "implements") {
throw Exception("traceclassmethods error:implements cannot parse correctly")
}
superClassName = classInfoItems[2]
} else {
className = classInfoItems[0]
}
while (iterator.hasNext()) {
val methodInfoItems = iterator.next().trim().split(" ")
if (methodInfoItems[0] == "}") {
continue@loop
}
val traceMethod = FilterTraceMethodData()
traceMethod.method = methodInfoItems[0]
traceMethod.className = className
traceMethod.superClassName = superClassName
traceMethodSet.add(traceMethod)
}
}
item.startsWith("-enablepreciseinstrumentation") -> {
enablePreciseInstrumentation = true
}
}
}
RheaLog.i(TAG, " allow packages: $allowPackages, block packages: $blockPackages")
}

@withoutbuff
Copy link
Author

rheaTrace {
compilation {
traceFilterFilePath = "${project.rootDir}/trace-filter/traceFilter.txt"
needPackageWithMethodMap = true
applyMethodMappingFilePath = ""
}
}

@withoutbuff
Copy link
Author

以下三种分隔方式都不行
使用空格分隔
-blockpackage com/airbnb/lottie/LottieTask androidx/exifinterface/media/ExifInterface
使用逗号分隔
-blockpackage com/airbnb/lottie/LottieTask,androidx/exifinterface/media/ExifInterface
使用换行符分隔
-blockpackage com/airbnb/lottie/LottieTask
androidx/exifinterface/media/ExifInterface

@withoutbuff
Copy link
Author

找了源码相关部分,应该这么写,但是只有最后一行有用
-blockpackage com/airbnb/lottie/LottieTask
-blockpackage androidx/exifinterface/media/ExifInterface
-blockpackage com/tencent/tinker/android/dex/Dex
-blockpackage com/android/multidex/MainDexListBuilder

@withoutbuff withoutbuff changed the title BuildException报错8个jar包 打包报错,BuildException报错8个jar包 Oct 11, 2024
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

1 participant