Tencent / tinker

Tinker is a hot-fix solution library for Android, it supports dex, library and resources update without reinstall apk.
Other
17.17k stars 3.34k forks source link

修复成功后,校验构造方法non-direct #1012

Closed alhah closed 5 years ago

alhah commented 5 years ago
异常类型:app运行时异常

手机型号:线上问题,各种设备型号都有

手机系统版本: Android 7.0 & 7.1

tinker版本:如:1.9.9

是否使用热更新SDK: TinkerPatch SDK

堆栈/日志:

Caused by:
--
java.lang.VerifyError:Verifier rejected class com.google.protobuf.micro.c: int com.google.protobuf.micro.c.a(int) failed to verify: int com.google.protobuf.micro.c.a(int): [0x1] rejecting non-direct call to constructor int com.google.protobuf.micro.f.<clinit>(int, int)Verifier rejected class com.google.protobuf.micro.c: void com.google.protobuf.micro.c.e(int, int) failed to verify: void com.google.protobuf.micro.c.e(int, int): [0x0] rejecting non-direct call to constructor int com.google.protobuf.micro.f.<clinit>(int, int) (declaration of 'com.google.protobuf.micro.c' appears in /data/user/0/com.smile.gifmaker/tinker/patch-e5d2f516/dex/tinker_classN.apk:classes3.dex)

com.xiaomi.push.c.b$b.b(Unknown Source)
com.google.protobuf.micro.e.c(Unknown Source)
com.xiaomi.push.service.av.a(Unknown Source)
com.xiaomi.e.f.c(Unknown Source)
com.xiaomi.smack.h.o(Unknown Source)
com.xiaomi.push.service.XMPushService.h(Unknown Source)
com.xiaomi.push.service.XMPushService$d.a(Unknown Source)
com.xiaomi.push.service.XMPushService$i.run(Unknown Source)
com.xiaomi.push.service.bl$c.run(Unknown Source)
alhah commented 5 years ago

与#711 类似

wstczlt commented 5 years ago

已查明: proguard的MappingReader里面默认会把inline也解析成method映射了,可以查看processClassMemberMapping()方法, 这个是proguard历史版本一直都有的问题,所以只要mapping里面有类似1000:1000:int a(int,int):0:0 -> 的映射时,下次applyMapping一定出错 proguard 6.0版本开始,对short method的inline长度判断,对android从默认长度为8改成了默认32,且新版本的proguard对/存在inline,导致android上部分短方法开始被inline,从而出现问题,详细代码可以阅读MethodInliner在proguard5.3.3的源码,以及6.0.1的源码。 解决方法: 回退到proguard 5.x版本,等待progurd修复这个问题,由于proguard不开源,所以目前只邮件给eric处理了; 禁用短方法内联:-optimizations !method/inlining/short