eleme / Amigo

A hotfix library for Android platform, and not just this...
Other
1.36k stars 213 forks source link

三星 SM-C7000 android 7.0 手机热更新后crash #261

Closed caihuapcl2013 closed 6 years ago

caihuapcl2013 commented 6 years ago

三星 SM-C7000 android 7.0 手机热更新后crash: 下面是日志(是不是7.0之后手机不支持资源更新,或者说 LayoutInflater.from(context).inflate 这种方式加载资源在7.0上不支持更新): Process: cn.pear.browser, PID: 18951 java.lang.RuntimeException: Unable to start activity ComponentInfo{cn.pear.browser/cn.pear.browser.activities.SparrowActivity}: android.view.InflateException: Binary XML file line #125: Binary XML file line #125: Error inflating class cn.pear.browser.view.BrowserSearchView at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2984) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3045) at android.app.ActivityThread.-wrap14(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1642) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6776) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1518) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1408) Caused by: android.view.InflateException: Binary XML file line #125: Binary XML file line #125: Error inflating class cn.pear.browser.view.BrowserSearchView Caused by: android.view.InflateException: Binary XML file line #125: Error inflating class cn.pear.browser.view.BrowserSearchView Caused by: java.lang.reflect.InvocationTargetException at java.lang.reflect.Constructor.newInstance0(Native Method) at java.lang.reflect.Constructor.newInstance(Constructor.java:430) at android.view.LayoutInflater.createView(LayoutInflater.java:652) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:794) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:734) at android.view.LayoutInflater.rInflate(LayoutInflater.java:865) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:828) at android.view.LayoutInflater.inflate(LayoutInflater.java:525) at android.view.LayoutInflater.inflate(LayoutInflater.java:427) at android.view.LayoutInflater.inflate(LayoutInflater.java:378) at cn.pear.browser.view.x.a(TabView.java:157) at cn.pear.browser.view.x.(TabView.java:148) at cn.pear.browser.view.x.(TabView.java:142) at cn.pear.browser.view.x.(TabView.java:138) at cn.pear.browser.activities.SparrowActivity.c(SparrowActivity.java:400) at cn.pear.browser.activities.SparrowActivity.onCreate(SparrowActivity.java:316) at android.app.Activity.performCreate(Activity.java:6956) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1126) at me.ele.amigo.AmigoInstrumentation.callActivityOnCreate(AmigoInstrumentation.java:320) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2927) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3045) at android.app.ActivityThread.-wrap14(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1642) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6776) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1518) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1408) Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x7f040048 at android.content.res.ResourcesImpl.getValue(ResourcesImpl.java:202) at android.content.res.Resources.loadXmlResourceParser(Resources.java:2970) at android.content.res.Resources.getLayout(Resources.java:1986) at android.view.LayoutInflater.inflate(LayoutInflater.java:425) at android.view.LayoutInflater.inflate(LayoutInflater.java:378) at cn.pear.browser.view.BrowserSearchView.a(BrowserSearchView.java:184) at cn.pear.browser.view.BrowserSearchView.(BrowserSearchView.java:174) at cn.pear.browser.view.BrowserSearchView.(BrowserSearchView.java:169) at java.lang.reflect.Constructor.newInstance0(Native Method)  at java.lang.reflect.Constructor.newInstance(Constructor.java:430)  at android.view.LayoutInflater.createView(LayoutInflater.java:652)  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:794)  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:734)  at android.view.LayoutInflater.rInflate(LayoutInflater.java:865)  at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:828)  at android.view.LayoutInflater.inflate(LayoutInflater.java:525)  at android.view.LayoutInflater.inflate(LayoutInflater.java:427)  at android.view.LayoutInflater.inflate(LayoutInflater.java:378)  at cn.pear.browser.view.x.a(TabView.java:157)  at cn.pear.browser.view.x.(TabView.java:148)  at cn.pear.browser.view.x.(TabView.java:142)  at cn.pear.browser.view.x.(TabView.java:138)  at cn.pear.browser.activities.SparrowActivity.c(SparrowActivity.java:400)  at cn.pear.browser.activities.SparrowActivity.onCreate(SparrowActivity.java:316)  at android.app.Activity.performCreate(Activity.java:6956)  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1126)  at me.ele.amigo.AmigoInstrumentation.callActivityOnCreate(AmigoInstrumentation.java:320)  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2927)  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3045)  at android.app.ActivityThread.-wrap14(ActivityThread.java)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1642)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:154)  at android.app.ActivityThread.main(ActivityThread.java:6776)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1518)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1408) 

JackCho commented 6 years ago

支持资源更新的,这个是必现么? 建议剥离一个简易可复现的demo,上传到github一起看

caihuapcl2013 commented 6 years ago

这是一个必现的BUG ,我们公司所有的7.0手机上都有这种问题!晚点我试着做一相DEMO 看看能不能必现这个问题!

JackCho commented 6 years ago

@caihuapcl2013 Amigo plugin你没有依赖,同时把android plugin 降到 2.3.0

buildscript {

    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.0'
        classpath 'me.ele:amigo:0.6.8'
    }
}
apply plugin: 'com.android.application'
apply plugin: 'me.ele.amigo'
caihuapcl2013 commented 6 years ago

@JackCho 不好意思DEMO我忘记加了,加上去可以更新资源,但还是之前的问题在复杂工程里面(有大量代码和资源要更新)必Crash 现象是更新完了之后,部分新的功能都可以用了(也就是部分资源更新没问题),进入主界面后 CRASH Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x7f040048

注:我在想办法做成DEMO, 到时麻烦你看一下