Tencent / Shadow

零反射全动态Android插件框架
BSD 3-Clause "New" or "Revised" License
7.47k stars 1.31k forks source link

java.lang.VerifyError: Rejecting class com.demo.pluginmanager.UpPluginManager that attempts to sub-type erroneous class com.demo.pluginmanager.FastPluginManager (declaration of 'com.demo.pluginmanager.UpPluginManager' appears in /data/user/0/com.demo/files/upshadowmanager-release-1.3.4.2023070701.apk) #1282

Open jalen-ma opened 10 months ago

jalen-ma commented 10 months ago

@shifujun 我们线上崩溃采集发现一些插件崩溃问题,目前分析跟android12及升级targetsdk30有关。

  1. 都出现在android12手机
  2. 升级targetsdk30才会出现

崩溃的堆栈: java.lang.VerifyError: Rejecting class com.demo.pluginmanager.UpPluginManager that attempts to sub-type erroneous class com.demo.pluginmanager.FastPluginManager (declaration of 'com.demo.pluginmanager.UpPluginManager' appears in /data/user/0/com.demo/files/upshadowmanager-release-1.3.4.2023070701.apk) at com.tencent.shadow.dynamic.impl.ManagerFactoryImpl.buildManager(ManagerFactoryImpl.java:21) at com.tencent.shadow.dynamic.host.ManagerImplLoader.load(ManagerImplLoader.java:70) at com.tencent.shadow.dynamic.host.DynamicPluginManager.updateManagerImpl(DynamicPluginManager.java:80) at com.tencent.shadow.dynamic.host.DynamicPluginManager.enter(DynamicPluginManager.java:55) at com.demo.foundation.manager.DefaultManagerImp.initLoaderAndRuntime$upshadowfoundation_release(DefaultManagerImp.kt:61) at com.demo.foundation.manager.DefaultManagerImp.initLoaderAndRuntime$upshadowfoundation_release$default(DefaultManagerImp.kt:51) at com.demo.foundation.ShadowManager$initManager$result$1.invokeSuspend(ShadowManager.kt:143) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108) at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:280) at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:85) at kotlinx.coroutines.BuildersKtBuildersKt.runBlocking(Builders.kt:59) at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source:1) at kotlinx.coroutines.BuildersKtBuildersKt.runBlocking$default(Builders.kt:38) at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source:1) at com.demo.foundation.ShadowManager.initManager(ShadowManager.kt:76) at com.demo.integration.manager.ShadowIntegrationManager$initShadowManager$1.invokeSuspend(ShadowIntegrationManager.kt:257) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108) at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:115) at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:103) at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684) Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@a81560b, Dispatchers.IO] Caused by: java.lang.VerifyError: Rejecting class com.demo.pluginmanager.FastPluginManager that attempts to sub-type erroneous class com.tencent.shadow.dynamic.manager.PluginManagerThatUseDynamicLoader (declaration of 'com.demo.pluginmanager.FastPluginManager' appears in /data/user/0/com.demo/files/upshadowmanager-release-1.3.4.2023070701.apk) ... 25 more Caused by: java.lang.VerifyError: Rejecting class com.tencent.shadow.dynamic.manager.PluginManagerThatUseDynamicLoader that attempts to sub-type erroneous class com.tencent.shadow.dynamic.manager.BaseDynamicPluginManager (declaration of 'com.tencent.shadow.dynamic.manager.PluginManagerThatUseDynamicLoader' appears in /data/user/0/com.demo/files/upshadowmanager-release-1.3.4.2023070701.apk) ... 25 more Caused by: java.lang.VerifyError: Rejecting class com.tencent.shadow.dynamic.manager.BaseDynamicPluginManager that attempts to sub-type erroneous class com.tencent.shadow.core.manager.BasePluginManager (declaration of 'com.tencent.shadow.dynamic.manager.BaseDynamicPluginManager' appears in /data/user/0/com.demo/files/upshadowmanager-release-1.3.4.2023070701.apk) ... 25 more Caused by: java.lang.VerifyError: Verifier rejected class com.tencent.shadow.core.manager.BasePluginManager: boolean com.tencent.shadow.core.manager.BasePluginManager.is64BitInstructionSet(java.lang.String) failed to verify: boolean com.tencent.shadow.core.manager.BasePluginManager.is64BitInstructionSet(java.lang.String): [0x2] 'this' argument 'Precise Reference: java.lang.String' not instance of 'Unresolved Reference: java.lang.String' boolean com.tencent.shadow.core.manager.BasePluginManager.isKnownInstructionSet(java.lang.String) failed to verify: boolean com.tencent.shadow.core.manager.BasePluginManager.isKnownInstructionSet(java.lang.String): [0x2] 'this' argument 'Precise Reference: java.lang.String' not instance of 'Unresolved Reference: java.lang.String' (declaration of 'com.tencent.shadow.core.manager.BasePluginManager' appears in /data/user/0/com.demo/files/upshadowmanager-release-1.3.4.2023070701.apk)

shifujun commented 10 months ago

如果项目的source sample可以在虚拟机上复现问题,我们可以一起分析下怎么解决。

xiboliya2000 commented 9 months ago

如果项目的source sample可以在虚拟机上复现问题,我们可以一起分析下怎么解决。

你好,我们目前也无法复现,这个问题是在线上收集到的崩溃。想问一下,通过崩溃堆栈来看的话,能不能给一个解决或规避问题的思路,谢谢!

wys619 commented 8 months ago

我遇到的一个重现的方式是插件包的类继承宿主的类,举个例子: 1、activity A是定义在插件里面的; 2、activity B是定义在宿主里面的,是一个抽象类或者是可被继承的; 3、activity B通过whiteList共享给了插件; 4、activity A继承了activity B; 5、这个时候在插件里面启动activity A,就会爆类似的现象;