TinkerPatch / tinkerpatch-sdk

TinkerPatch SDK
http://tinkerpatch.com
MIT License
294 stars 56 forks source link

Tinker补丁下发后,程序直接崩溃 #113

Closed life90player closed 5 years ago

life90player commented 5 years ago

贴一段相关日志

12-20 10:03:13.571 24417-24417/? E/Tinker.SampleUncaughtExHandler: tinker has fast crash 1 times
12-20 10:03:13.787 24417-24417/? E/Tinker.UncaughtHandler: TinkerUncaughtHandler catch exception:java.lang.RuntimeException: Unable to start activity ComponentInfo{com.yunmayi.cashier/com.yunmayi.cashier.client.main.DashboardActivity}: android.view.InflateException: Binary XML file line #31: Error inflating class <unknown>
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2190)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2335)
        at android.app.ActivityThread.access$800(ActivityThread.java:141)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1202)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:136)
        at android.app.ActivityThread.main(ActivityThread.java:5103)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:515)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
        at dalvik.system.NativeStart.main(Native Method)
     Caused by: android.view.InflateException: Binary XML file line #31: Error inflating class <unknown>
        at android.view.LayoutInflater.createView(LayoutInflater.java:620)
        at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
        at android.view.LayoutInflater.onCreateView(LayoutInflater.java:669)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:694)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
        at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287)
        at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139)
        at com.yunmayi.cashier.base.activity.BaseActivity.onCreate(BaseActivity.java:30)
        at com.yunmayi.cashier.client.main.DashboardActivity.onCreate(DashboardActivity.java:79)
        at android.app.Activity.performCreate(Activity.java:5247)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2154)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2335) 
        at android.app.ActivityThread.access$800(ActivityThread.java:141) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1202) 
        at android.os.Handler.dispatchMessage(Handler.java:102) 
        at android.os.Looper.loop(Looper.java:136) 
        at android.app.ActivityThread.main(ActivityThread.java:5103) 
        at java.lang.reflect.Method.invokeNative(Native Method) 
        at java.lang.reflect.Method.invoke(Method.java:515) 
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601) 
        at dalvik.system.NativeStart.main(Native Method) 
     Caused by: java.lang.reflect.InvocationTargetException
        at java.lang.reflect.Constructor.constructNative(Native Method)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at android.view.LayoutInflater.createView(LayoutInflater.java:594)
        at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56) 
        at android.view.LayoutInflater.onCreateView(LayoutInflater.java:669) 
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:694) 
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:755) 
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:758) 
        at android.view.LayoutInflater.inflate(LayoutInflater.java:492) 
        at android.view.LayoutInflater.inflate(LayoutInflater.java:397) 
        at android.view.LayoutInflater.inflate(LayoutInflater.java:353) 
        at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287) 
        at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139) 
        at com.yunmayi.cashier.base.activity.BaseActivity.onCreate(BaseActivity.java:30) 
        at com.yunmayi.cashier.client.main.DashboardActivity.onCreate(DashboardActivity.java:79) 
        at android.app.Activity.performCreate(Activity.java:5247) 
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) 
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2154) 
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2335) 
        at android.app.ActivityThread.access$800(ActivityThread.java:141) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1202) 
        at android.os.Handler.dispatchMessage(Handler.java:102) 
        at android.os.Looper.loop(Looper.java:136) 
        at android.app.ActivityThread.main(ActivityThread.java:5103) 
        at java.lang.reflect.Method.invokeNative(Native Method) 
        at java.lang.reflect.Method.invoke(Method.java:515) 
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601) 
        at dalvik.system.NativeStart.main(Native Method) 
     Caused by: android.content.res.Resources$NotFoundException: File res/drawable/nav_bg_1.xml from drawable resource ID #0x7f0800a7
        at android.content.res.Resources.loadDrawable(Resources.java:2096)
        at android.content.res.TypedArray.getDrawable(TypedArray.java:602)
        at android.view.View.<init>(View.java:3554)
        at android.view.View.<init>(View.java:3484)
        at android.view.ViewGroup.<init>(ViewGroup.java:464)
        at android.widget.RelativeLayout.<init>(RelativeLayout.java:236)
        at java.lang.reflect.Constructor.constructNative(Native Method) 
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423) 
        at android.view.LayoutInflater.createView(LayoutInflater.java:594) 
        at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56) 
        at android.view.LayoutInflater.onCreateView(LayoutInflater.java:669) 
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:694) 
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:755) 
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:758) 
        at android.view.LayoutInflater.inflate(LayoutInflater.java:492) 
        at android.view.LayoutInflater.inflate(LayoutInflater.java:397) 
        at android.view.LayoutInflater.inflate(LayoutInflater.java:353) 
        at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287) 
        at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139) 
        at com.yunmayi.cashier.base.activity.BaseActivity.onCreate(BaseActivity.java:30) 
        at com.yunmayi.cashier.client.main.DashboardActivity.onCreate(DashboardActivity.java:79) 
        at android.app.Activity.performCreate(Activity.java:5247) 
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) 
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2154) 
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2335) 
        at android.app.ActivityThread.access$800(ActivityThread.java:141) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1202) 
        at android.os.Handler.dispatchMessage(Handler.java:102) 
        at android.os.Looper.loop(Looper.java:136) 
        at android.app.ActivityThread.main(ActivityThread.java:5103) 
        at java.lang.reflect.Method.invokeNative(Native Method) 
        at java.lang.reflect.Method.invoke(Method.java:515) 
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601) 
        at dalvik.system.NativeStart.main(Native Method) 
     Caused by: java.lang.UnsupportedOperationException: Can't convert to dimension: type=0x1
        at android.content.res.TypedArray.getDimensionPixelSize(TypedArray.java:464)
        at android.graphics.drawable.GradientDrawable.inflate(GradientDrawable.java:994)
        at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:937)
        at android.graphics.drawable.LayerDrawable.inflate(LayerDrawable.java:168)
        at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:937)
        at android.graphics.drawable.Drawable.createFromXml(Drawable.java:877)
        at android.content.res.Resources.loadDrawable(Resources.java:2092)
        at android.content.res.TypedArray.getDrawable(TypedArray.java:602) 
        at android.view.View.<init>(View.java:3554) 
        at android.view.View.<init>(View.java:3484) 
        at android.view.ViewGroup.<init>(ViewGroup.java:464) 
        at android.widget.RelativeLayout.<init>(RelativeLayout.java:236) 
        at java.lang.reflect.Constructor.constructNative(Native Method) 
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423) 
        at android.view.LayoutInflater.createView(LayoutInflater.java:594) 
        at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56) 
        at android.view.LayoutInflater.onCreateView(LayoutInflater.java:669) 
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:694) 
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:755) 
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:758) 
        at android.view.LayoutInflater.inflate(LayoutInflater.java:492) 
        at android.view.LayoutInflater.inflate(LayoutInflater.java:397) 
        at android.view.LayoutInflater.inflate(LayoutInflater.java:353) 
        at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287) 
        at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139) 
        at com.yunmayi.cashier.base.activity.BaseActivity.onCreate(BaseActivity.java:30) 
        at com.yunmayi.cashier.client.main.DashboardActivity.onCreate(DashboardActivity.java:79) 
        at android.app.Activity.performCreate(Activity.java:5247) 
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) 
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2154) 
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2335) 
        at android.app.ActivityThread.access$800(ActivityThread.java:141) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1202) 
        at android.os.Handler.dispatchMessage(Handler.java:102) 
        at android.os.Looper.loop(Looper.java:136) 
        at android.app.ActivityThread.main(ActivityThread.java:5103) 
        at java.lang.reflect.Method.invokeNative(Native Method) 
        at java.lang.reflect.Method.invoke(Method.java:515) 
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601) 
        at dalvik.system.NativeStart.main(Native Method) 
12-20 10:03:13.843 925-925/io.rong.push D/Tinker.DefaultAppLike: onTrimMemory level:5

此处我是没有修改资源文件的,仅仅在代码中增加了一行日志打印,然后下发补丁包,重启后补丁合入后就崩溃了

tinker配置: //热修复依赖 annotationProcessor("com.tinkerpatch.tinker:tinker-android-anno:1.9.8") compileOnly 'com.tinkerpatch.tinker:tinker-android-anno:1.9.8' implementation 'com.tinkerpatch.sdk:tinkerpatch-android-sdk:1.2.8' tinker Gradle 编译配置 classpath 'com.android.tools.build:gradle:3.2.1' // TinkerPatch 插件 classpath "com.tinkerpatch.sdk:tinkerpatch-gradle-plugin:1.2.9" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files classpath "com.tencent.bugly:tinker-support:1.1.5" 项目使用gradle版本: gradle-4.6-all.zip 运行环境:Android 4.4 minSdkVersion 19 targetSdkVersion 26 希望能得到码主的回复,谢谢。

simpleton commented 5 years ago

你可以先尝试一下sample: https://github.com/TinkerPatch/tinkerpatch-easy-sample

然后再check 一下如下:

exception:java.lang.RuntimeException: Unable to start activity ComponentInfo{com.yunmayi.cashier/com.yunmayi.cashier.client.main.DashboardActivity}: 

android.view.InflateException: Binary XML file line #31: Error inflating class <unknown> at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2190) at 
life90player commented 5 years ago

找到问题了,tinker不知道为什么在资源没有变动的情况下,对比居然发现资源变动了,于是生成了资源补丁,我把aapt2禁用了可以了,最后考虑到我实际不需要打包资源补丁,于是在gradle忽略了对比资源文件,请问这样会不会造成一些可能出现的问题?

simpleton commented 5 years ago

最新版是支持aapt2 的

On Wed, Dec 26, 2018, 9:56 PM life90player <notifications@github.com wrote:

找到问题了,tinker不知道为什么在资源没有变动的情况下,对比居然发现资源变动了,于是生成了资源补丁,我把aapt2禁用了可以了,最后考虑到我实际不需要打包资源补丁,于是在gradle忽略了对比资源文件,请问这样会不会造成一些可能出现的问题?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/TinkerPatch/tinkerpatch-sdk/issues/113#issuecomment-450081190, or mute the thread https://github.com/notifications/unsubscribe-auth/AAbvYgTvjv4KigtFBfJt3LZlv79_DSWpks5u9GEKgaJpZM4ZbX71 .

life90player commented 5 years ago

好的,感谢回答