jasonross / Nuwa

Nuwa, pure java implementation, can hotfix your android application.
2.96k stars 574 forks source link

使用Nuwa 替换 Activity 出现问题 #52

Closed RebortY closed 8 years ago

RebortY commented 8 years ago

将 MainAcitivty 作为了 补丁, 修改了 此activity种的一些信息。 但是在 加载插件完成后。

在启动此activity 的时候,会报如下错误。

W/dalvikvm: VFY: unable to find class referenced in signature (Landroid/view/SearchEvent;) 01-27 01:49:10.305 7975-7975/com.jingoal.hotfix I/dalvikvm: Could not find method android.view.Window$Callback.onSearchRequested, referenced from method android.support.v7.view.WindowCallbackWrapper.onSearchRequested 01-27 01:49:10.305 7975-7975/com.jingoal.hotfix W/dalvikvm: VFY: unable to resolve interface method 17967: Landroid/view/Window$Callback;.onSearchRequested (Landroid/view/SearchEvent;)Z 01-27 01:49:10.305 7975-7975/com.jingoal.hotfix D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002 01-27 01:49:10.305 7975-7975/com.jingoal.hotfix I/dalvikvm: Could not find method android.view.Window$Callback.onWindowStartingActionMode, referenced from method android.support.v7.view.WindowCallbackWrapper.onWindowStartingActionMode 01-27 01:49:10.305 7975-7975/com.jingoal.hotfix W/dalvikvm: VFY: unable to resolve interface method 17971: Landroid/view/Window$Callback;.onWindowStartingActionMode (Landroid/view/ActionMode$Callback;I)Landroid/view/ActionMode; 01-27 01:49:10.305 7975-7975/com.jingoal.hotfix D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002 01-27 01:49:10.313 7975-7975/com.jingoal.hotfix W/dalvikvm: Class resolved by unexpected DEX: Landroid/support/v7/app/AppCompatViewInflater;(0xa543c7c0):0x97d9f000 ref [Landroid/support/v7/appcompat/R$styleable;] Landroid/support/v7/appcompat/R$styleable;(0xa543c7c0):0x97cf6000 01-27 01:49:10.313 7975-7975/com.jingoal.hotfix W/dalvikvm: (Landroid/support/v7/app/AppCompatViewInflater; had used a different Landroid/support/v7/appcompat/R$styleable; during pre-verification) 01-27 01:49:10.313 7975-7975/com.jingoal.hotfix D/AndroidRuntime: Shutting down VM 01-27 01:49:10.317 7975-7975/com.jingoal.hotfix W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0xa4b9f648) 01-27 01:49:10.325 7975-7975/com.jingoal.hotfix E/AndroidRuntime: FATAL EXCEPTION: main java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation

当然主要的还是: Class resolved by unexpected DEX: Landroid/support/v7/app/AppCompatViewInflater;(0xa543c7c0):0x97d9f000 ref [Landroid/support/v7/appcompat/R$styleable;] Landroid/support/v7/appcompat/R$styleable;(0xa543c7c0):0x97cf6000 01-27 01:49:10.313 7975-7975/com.jingoal.hotfix W/dalvikvm: (Landroid/support/v7/app/AppCompatViewInflater; had used a different Landroid/support/v7/appcompat/R$styleable; during pre-verification)

出现了 Landroid/support/v7/appcompat/R$styleable;] 内存地址指向出现了两份。 导致 java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation 这个异常的出现。

是Activity 不可以作为 fix 的类么?

jjding1986 commented 8 years ago

关注楼主这个场景,我试过修改除ContentProvider外三大组件,都可以成功替换修复

RebortY commented 8 years ago

这个问题,已经解决了,主要是对主工程 去标记处理弄错了。按照demo来使用,可以修复