-
Notifications
You must be signed in to change notification settings - Fork 280
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
Exception in thread "main" java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0 #138
Comments
采集的 trace 数据为空的失败,看下 methodMapping.txt 文件里插桩了哪些方法,在 trace 采集时这些方法会不会被执行,是不是因为插桩方法都没有执行导致的 |
我看methodMapping中非常多的方法。我设置下过滤吧,然后是不是因为我整个项目是compose 写的,所以会插桩失败。 |
还可以检查下 apk 看 methodMapping 中记录的方法是否确实插桩成功了,插桩后方法的开始和结束会有 TraceStub.i(int) 和 TraceStub.o(int, long) 方法的调用 |
我看了下确实很少的插桩,然后编译后有ignoreMethodMapp 这个文件里面有很多我需要插桩的类。这个是在哪里配置的呢? |
这个说明你 traceFilter 配置的不合理,加上诸如 -allowpackage com.weo 来指定需要插桩的包路径吧 |
现在可以了。我不知道是不是因为我重启了下手机。还是我去掉了项目中另外一个插件。现在可以抓了。 |
gradle:
classpath 'com.android.tools.build:gradle:7.2.2'
distributionUrl=https://services.gradle.org/distributions/gradle-7.5-bin.zip
配置:
apply plugin: 'com.bytedance.rhea-trace'
implementation "com.bytedance.btrace:rhea-core:2.0.3-rc03"
rheaTrace {
compilation {
traceFilterFilePath = ""
needPackageWithMethodMap = true
applyMethodMappingFilePath = ""
}
}
执行命令:
java -jar rhea-trace-processor-2.0.0.jar -a com.weo.projectz -t 10 -o output.pb rhea.all sched -fullClassName -debug -mode simple
报错
08-13 15:06:15.180 D RheaTrace : SystemTime is 0
08-13 15:06:15.180 D RheaTrace : BootTime is 16038188335075
08-13 15:06:15.180 D RheaTrace : Monotonic is 15431727692913
Exception in thread "main" java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0
at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:100)
at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:106)
at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:302)
at java.base/java.util.Objects.checkIndex(Objects.java:365)
at java.base/java.util.ArrayList.get(ArrayList.java:428)
at com.bytedance.rheatrace.processor.core.AppTraceProcessor.processBinary(AppTraceProcessor.java:200)
at com.bytedance.rheatrace.processor.core.AppTraceProcessor.getBinaryTrace(AppTraceProcessor.java:50)
at com.bytedance.rheatrace.processor.lite.LiteCapture.process(LiteCapture.java:73)
at com.bytedance.rheatrace.processor.Main.main(Main.java:108)
08-13 15:06:15.236 D RheaTrace : Run adb shell setprop debug.rhea.startWhenAppLaunch 0
08-13 15:06:15.279 D RheaTrace : Run adb shell setprop debug.rhea.mainThreadOnly 0
08-13 15:06:15.324 D RheaTrace : Run adb shell setprop debug.rhea.methodDurThreshold 0
08-13 15:06:15.373 D RheaTrace : Run adb shell setprop debug.rhea.category.all 0
log.log
log.log
The text was updated successfully, but these errors were encountered: