Tencent / matrix

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

与Tinker一起使用,报错 #466

Open liuleshuai opened 4 years ago

liuleshuai commented 4 years ago

Issue /提问须知

在提交 issue 之前,我们应该先查询是否已经有相关的 issue 以及常见问题。提交 issue 时,我们需要写明 issue 的原因,以及编译或运行过程的日志。issue 需要以下面的格式:


异常类型:app 运行时异常

手机型号:华为mate9

手机系统版本:Android 9.0

matrix版本:0.6.5

gradle版本:3.2.1

问题描述:集成matrix后,与Tinker一起使用启动崩溃。

堆栈/日志:
`java.lang.RuntimeException: Unable to instantiate application com.tinkerpatch.sdk.loader.TinkerPatchReflectApplication: java.lang.ClassNotFoundException: Didn't find class "com.tinkerpatch.sdk.loader.TinkerPatchReflectApplication" on path: DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/com.wodi.who-mwU0oMn_gTGFRRgMWlAw5g==/base.apk"],nativeLibraryDirectories=[/data/app/com.wodi.who-mwU0oMn_gTGFRRgMWlAw5g==/lib/arm, /data/app/com.wodi.who-mwU0oMn_gTGFRRgMWlAw5g==/base.apk!/lib/armeabi-v7a, /system/lib, /product/lib]]
        at android.app.LoadedApk.makeApplication(LoadedApk.java:1183)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6688)
        at android.app.ActivityThread.access$2000(ActivityThread.java:273)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2020)
        at android.os.Handler.dispatchMessage(Handler.java:112)
        at android.os.Looper.loop(Looper.java:216)
        at android.app.ActivityThread.main(ActivityThread.java:7625)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:987)
     Caused by: java.lang.ClassNotFoundException: Didn't find class "com.tinkerpatch.sdk.loader.TinkerPatchReflectApplication" on path: DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/com.wodi.who-mwU0oMn_gTGFRRgMWlAw5g==/base.apk"],nativeLibraryDirectories=[/data/app/com.wodi.who-mwU0oMn_gTGFRRgMWlAw5g==/lib/arm, /data/app/com.wodi.who-mwU0oMn_gTGFRRgMWlAw5g==/base.apk!/lib/armeabi-v7a, /system/lib, /product/lib]]
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
        at android.app.AppComponentFactory.instantiateApplication(AppComponentFactory.java:50)
        at android.app.Instrumentation.newApplication(Instrumentation.java:1127)
        at android.app.LoadedApk.makeApplication(LoadedApk.java:1175)`
gdutxiaoxu commented 3 years ago

可以看一下我提的这个 pr,本地自测,是可以解决这个问题了。最根本的原因是 增量编译的情况下, transfrom input 和 output 的文件路径是一样的,导致读写冲突,jar 包大小变为 0.

https://github.com/Tencent/matrix/pull/661