Tencent / matrix

Matrix is a plugin style, non-invasive APM system developed by WeChat.
Other
11.63k stars 1.88k forks source link

JSR/RET are not supported with computeFrames option #760

Open lodqc opened 2 years ago

lodqc commented 2 years ago

异常类型:app 运行时异常

手机型号:realme

手机系统版本:Android 12

matrix版本:2.0.8

gradle版本:4.1.1

问题描述:java.lang.NoClassDefFoundError: Failed resolution of: Lcom/amap/api/maps/model/LatLng;

堆栈/日志: E/CrashReport: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/amap/api/maps/model/LatLng; at java.lang.reflect.Executable.getParameterTypesInternal(Native Method) at java.lang.reflect.Method.getParameterTypes(Method.java:186) at org.greenrobot.eventbus.SubscriberMethodFinder.findUsingReflectionInSingleClass(SubscriberMethodFinder.java:163) at org.greenrobot.eventbus.SubscriberMethodFinder.findUsingInfo(SubscriberMethodFinder.java:88) at org.greenrobot.eventbus.SubscriberMethodFinder.findSubscriberMethods(SubscriberMethodFinder.java:64) at org.greenrobot.eventbus.EventBus.register(EventBus.java:136) at mainmap.MainMapFragment.onCreate(MainMapFragment.java:405) at androidx.fragment.app.Fragment.performCreate(Fragment.java:2938) at androidx.fragment.app.FragmentStateManager.create(FragmentStateManager.java:475) at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:278) at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:2189) at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:2100) at androidx.fragment.app.FragmentManager.execSingleAction(FragmentManager.java:1971) at androidx.fragment.app.BackStackRecord.commitNowAllowingStateLoss(BackStackRecord.java:311) at androidx.fragment.app.FragmentStatePagerAdapter.finishUpdate(FragmentStatePagerAdapter.java:274) at androidx.viewpager.widget.ViewPager.populate(ViewPager.java:1244) at androidx.viewpager.widget.ViewPager.populate(ViewPager.java:1092) at androidx.viewpager.widget.ViewPager.onMeasure(ViewPager.java:1622) at android.view.View.measure(View.java:26130) at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:735) at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:481) at android.view.View.measure(View.java:26130) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7132) at android.widget.FrameLayout.onMeasure(FrameLayout.java:194) at androidx.appcompat.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:146) at android.view.View.measure(View.java:26130) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7132) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1552) at android.widget.LinearLayout.measureVertical(LinearLayout.java:842) at android.widget.LinearLayout.onMeasure(LinearLayout.java:721) at android.view.View.measure(View.java:26130) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7132) at android.widget.FrameLayout.onMeasure(FrameLayout.java:194) at android.view.View.measure(View.java:26130) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7132) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1552) at android.widget.LinearLayout.measureVertical(LinearLayout.java:842) at android.widget.LinearLayout.onMeasure(LinearLayout.java:721) at android.view.View.measure(View.java:26130) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7132) at android.widget.FrameLayout.onMeasure(FrameLayout.java:194) at com.android.internal.policy.DecorView.onMeasure(DecorView.java:832) at android.view.View.measure(View.java:26130) at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:3983) at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:2672) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2957) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2369) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:9332) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1185) at android.view.Choreographer.doCallbacks(Choreographer.java:975) at android.view.Choreographer.doFrame(Choreographer.java:875) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1170) at android.os.Handler.handleCallback(Handler.java:938) 2022-06-17 14:33:18.815 3493-3493/ E/CrashReport: at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:233) at android.os.Looper.loop(Looper.java:344) at android.app.ActivityThread.main(ActivityThread.java:8192) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:589) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1071) Caused by: java.lang.ClassNotFoundException: Didn't find class "com.amap.api.maps.model.LatLng" on path: DexPathList[[zip file "/data/app/roEfO_cHlH3MZIpSljdQ-w==/-JsbcFHnrSuQxGAlpfT_dNg==/base.apk"],nativeLibraryDirectories=[/data/app/roEfO_cHlH3MZIpSljdQ-w==/-JsbcFHnrSuQxGAlpfT_dNg==/lib/arm64, /data/app/~~roEfO_cHlH3MZIpSljdQ-w==/-JsbcFHnrSuQxGAlpfT_dNg==/base.apk!/lib/arm64-v8a, /system/lib64, /system_ext/lib64]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:218) at java.lang.ClassLoader.loadClass(ClassLoader.java:379) at java.lang.ClassLoader.loadClass(ClassLoader.java:312) ... 60 more

13120241790 commented 2 years ago

这看着像高德地图没有添加混淆脚本找不到高德 SDK 的 经纬度 bean 类,跟 matrix 有关系?

lodqc commented 2 years ago

debug跑的没有混淆啊,去掉matrix是正常的

Hackerofshi commented 2 years ago

java.lang.NoClassDefFoundError: Failed resolution of: Lcom/loc/dg; at com.amap.api.location.AMapLocationClient.(Unknown Source:44) at com.zhengan.rdr.util.LocationUtil.initLocation(LocationUtil.kt:185) at com.zhengan.rdr.service.LocationService.onStartCommand(LocationService.kt:30) at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3578) at android.app.ActivityThread.-wrap20(Unknown Source:0) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1727) at android.os.Handler.dispatchMessage(Handler.java:105) at android.os.Looper.loop(Looper.java:173) at android.app.ActivityThread.main(ActivityThread.java:6698) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:782) Caused by: java.lang.ClassNotFoundException: Didn't find class "com.loc.dg" on path: DexPathList[[zip file "/data/app/com.zhengan.rdr-KqfAOFstcZoMjXB23pWeOQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.zhengan.rdr-KqfAOFstcZoMjXB23pWeOQ==/lib/arm64, /data/app/com.zhengan.rdr-KqfAOFstcZoMjXB23pWeOQ==/base.apk!/lib/arm64-v8a, /system/lib64, /system/vendor/lib64]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:93) at java.lang.ClassLoader.loadClass(ClassLoader.java:379) at java.lang.ClassLoader.loadClass(ClassLoader.java:312) at com.amap.api.location.AMapLocationClient.(Unknown Source:44)  at com.zhengan.rdr.util.LocationUtil.initLocation(LocationUtil.kt:185)  at com.zhengan.rdr.service.LocationService.onStartCommand(LocationService.kt:30)  at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3578)  at android.app.ActivityThread.-wrap20(Unknown Source:0)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1727)  at android.os.Handler.dispatchMessage(Handler.java:105)  at android.os.Looper.loop(Looper.java:173)  at android.app.ActivityThread.main(ActivityThread.java:6698)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:782) 

    我这引入了以后地图模板也报错,引入这个不知道是不是有冲突
lodqc commented 2 years ago

我的地图崩溃前,gradle-plugin也会报错: [W][Matrix.Trace] [getMethodFromBaseMethod] not exist!E:\battery-station-android\batterystation\build\matrix_output\Debug.methodmap [I][Matrix.Trace] [ParseMappingTask#run] cost:1ms, black size:2, collect 0 method from E:\battery-station-android\batterystation\build/matrix_output/Debug.methodmap java.lang.NullPointerException at java.base/java.util.concurrent.ConcurrentHashMap.putVal(ConcurrentHashMap.java:1011) at java.base/java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:1006) at com.tencent.matrix.trace.MethodCollector$TraceClassAdapter.visit(MethodCollector.java:285) at org.objectweb.asm.ClassReader.accept(ClassReader.java:546) at org.objectweb.asm.ClassReader.accept(ClassReader.java:401) at com.tencent.matrix.trace.MethodCollector$CollectJarTask.run(MethodCollector.java:172) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:829)

Task :batterystation:transformClassesWithMatrixTraceTransformForATestDebug [I][Matrix.Trace] [doTransform] Step(1)[Parse]... cost:29ms

java.lang.NullPointerException at java.base/java.util.concurrent.ConcurrentHashMap.putVal(ConcurrentHashMap.java:1011) at java.base/java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:1006) at com.tencent.matrix.trace.MethodCollector$TraceClassAdapter.visit(MethodCollector.java:285) at org.objectweb.asm.ClassReader.accept(ClassReader.java:546) at org.objectweb.asm.ClassReader.accept(ClassReader.java:401) at com.tencent.matrix.trace.MethodCollector$CollectJarTask.run(MethodCollector.java:172) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:829) java.lang.NullPointerException at java.base/java.util.concurrent.ConcurrentHashMap.putVal(ConcurrentHashMap.java:1011) at java.base/java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:1006) at com.tencent.matrix.trace.MethodCollector$TraceClassAdapter.visit(MethodCollector.java:285) at org.objectweb.asm.ClassReader.accept(ClassReader.java:546) at org.objectweb.asm.ClassReader.accept(ClassReader.java:401) at com.tencent.matrix.trace.MethodCollector$CollectJarTask.run(MethodCollector.java:172) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:829) [I][MethodCollector] [saveIgnoreCollectedMethod] size:47550 path:E:\battery-station-android\batterystation\build\outputs\mapping\aTestDebug\ignoreMethodMapping.txt [I][MethodCollector] [saveCollectedMethod] size:83159 incrementCount:83158 path:E:\battery-station-android\batterystation\build\outputs\mapping\aTestDebug\methodMapping.txt

Task :batterystation:transformClassesWithMatrixTraceTransformForATestDebug [I][Matrix.Trace] [doTransform] Step(2)[Collection]... cost:1012ms

[E][Matrix.MethodTracer] [innerTraceMethodFromJar] input:E:\battery-station-android\batterystation\build\intermediates\transforms\APMSPlugin\aTest\debug\70.jar output:E:\battery-station-android\batterystation\build\intermediates\transforms\MatrixTraceTransform\aTest\debug\73.jar e:JSR/RET are not supported with computeFrames option java.nio.file.FileSystemException: E:\battery-station-android\batterystation\build\intermediates\transforms\MatrixTraceTransform\aTest\debug\73.jar: ��һ����������ʹ�ô��ļ��������޷����ʡ�

at java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:92)
at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103)
at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:108)
at java.base/sun.nio.fs.WindowsFileCopy.copy(WindowsFileCopy.java:164)
at java.base/sun.nio.fs.WindowsFileSystemProvider.copy(WindowsFileSystemProvider.java:287)
at java.base/java.nio.file.Files.copy(Files.java:1295)
at com.tencent.matrix.trace.MethodTracer.innerTraceMethodFromJar(MethodTracer.java:256)
at com.tencent.matrix.trace.MethodTracer$2.run(MethodTracer.java:115)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)

[E][Matrix.MethodTracer] [innerTraceMethodFromJar] input:E:\battery-station-android\batterystation\build\intermediates\transforms\APMSPlugin\aTest\debug\69.jar output:E:\battery-station-android\batterystation\build\intermediates\transforms\MatrixTraceTransform\aTest\debug\72.jar e:JSR/RET are not supported with computeFrames option java.nio.file.FileSystemException: E:\battery-station-android\batterystation\build\intermediates\transforms\MatrixTraceTransform\aTest\debug\72.jar: ��һ����������ʹ�ô��ļ��������޷����ʡ�

at java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:92)
at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103)
at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:108)
at java.base/sun.nio.fs.WindowsFileCopy.copy(WindowsFileCopy.java:164)
at java.base/sun.nio.fs.WindowsFileSystemProvider.copy(WindowsFileSystemProvider.java:287)
at java.base/java.nio.file.Files.copy(Files.java:1295)
at com.tencent.matrix.trace.MethodTracer.innerTraceMethodFromJar(MethodTracer.java:256)
at com.tencent.matrix.trace.MethodTracer$2.run(MethodTracer.java:115)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)

Task :batterystation:transformClassesWithMatrixTraceTransformForATestDebug [I][Matrix.Trace] [doTransform] Step(3)[Trace]... cost:16369ms [I][Matrix.TraceTransform] Insert matrix trace instrumentations cost time: 19105ms.

lodqc commented 2 years ago

已确定是ASM字节码处理过程中JSR/RET are not supported with computeFrames option 不支持导致的。https://stackoverflow.com/questions/19381417/compile-error-jsr-ret-are-not-supported-with-computeframes-option 尝试了此修复方案无用!!

lodqc commented 2 years ago

问题定位思路:将报错的jar包后缀名改为.zip查看,确实是amap相关的jar包。https://issues.apache.org/jira/browse/ARIES-1219?jql=text%20~%20%22JSR%2FRET%22 此链接有介绍此问题形成的原因

Heycz commented 2 years ago

确实是有这个问题,最近升级了高德的sdk就出问题。在mac机器上编译不会有问题,windows上编译就丢了一些类

igottime commented 2 years ago

可以查看我的 pull 先进行本地修复