Robust is an Android HotFix solution with high compatibility and high stability. Robust can fix bugs immediately without a reboot.
4.43k
stars
809
forks
source link
使用kotlin时。对于kotlin-android-extensions 生成的控件。修复的时候,报错该控件为null。 #436
Open
hanswook opened 4 years ago
异常类型:app运行时异常
手机型号:小米10青春版
手机系统版本:Android 10
Robust版本:0.4.99
Gradle版本:4.0.1
备注:下方报错信息中,“tvHot must not be null”里 tvHot 是通过kotlin-android-extensions映射的控件。热修复后。找不到该控件
系统:Mac 堆栈/日志: 2020-11-13 11:39:56.692 25631-25631/? D/ForceDarkHelper: updateByCheckExcludeList: pkg: com.hans.robusttest activity: com.hans.robusttest.MainHotpatchActivity@f573c76 2020-11-13 11:39:56.694 25631-25631/? W/System.err: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[])' on a null object reference 2020-11-13 11:39:56.695 25631-25631/? W/System.err: at com.meituan.robust.utils.EnhancedRobustUtils.invokeReflectMethod(EnhancedRobustUtils.java:2) 2020-11-13 11:39:56.695 25631-25631/? W/System.err: at com.hans.robusttest.patch.MainHotpatchActivityPatch.onCreate(MainHotpatchActivityPatch.java:16) 2020-11-13 11:39:56.695 25631-25631/? W/System.err: at com.hans.robusttest.patch.MainHotpatchActivityPatchControl.accessDispatch(Unknown Source:75) 2020-11-13 11:39:56.695 25631-25631/? W/System.err: at com.meituan.robust.PatchProxy.accessDispatch(PatchProxy.java:9) 2020-11-13 11:39:56.695 25631-25631/? W/System.err: at com.meituan.robust.PatchProxy.proxy(PatchProxy.java:4) 2020-11-13 11:39:56.695 25631-25631/? W/System.err: at com.hans.robusttest.MainHotpatchActivity.onCreate(Unknown Source:20) 2020-11-13 11:39:56.695 25631-25631/? W/System.err: at android.app.Activity.performCreate(Activity.java:7893) 2020-11-13 11:39:56.695 25631-25631/? W/System.err: at android.app.Activity.performCreate(Activity.java:7880) 2020-11-13 11:39:56.695 25631-25631/? W/System.err: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1307) 2020-11-13 11:39:56.695 25631-25631/? W/System.err: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3286) 2020-11-13 11:39:56.695 25631-25631/? W/System.err: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3460) 2020-11-13 11:39:56.695 25631-25631/? W/System.err: at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83) 2020-11-13 11:39:56.695 25631-25631/? W/System.err: at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) 2020-11-13 11:39:56.695 25631-25631/? W/System.err: at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) 2020-11-13 11:39:56.695 25631-25631/? W/System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2047) 2020-11-13 11:39:56.695 25631-25631/? W/System.err: at android.os.Handler.dispatchMessage(Handler.java:107) 2020-11-13 11:39:56.695 25631-25631/? W/System.err: at android.os.Looper.loop(Looper.java:224) 2020-11-13 11:39:56.695 25631-25631/? W/System.err: at android.app.ActivityThread.main(ActivityThread.java:7584) 2020-11-13 11:39:56.695 25631-25631/? W/System.err: at java.lang.reflect.Method.invoke(Native Method) 2020-11-13 11:39:56.695 25631-25631/? W/System.err: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539) 2020-11-13 11:39:56.695 25631-25631/? W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950) 2020-11-13 11:39:56.697 25631-25631/? W/System.err: java.lang.reflect.InvocationTargetException 2020-11-13 11:39:56.699 25631-25631/? W/System.err: at java.lang.reflect.Method.invoke(Native Method) 2020-11-13 11:39:56.699 25631-25631/? W/System.err: at com.meituan.robust.utils.EnhancedRobustUtils.invokeReflectStaticMethod(EnhancedRobustUtils.java:3) 2020-11-13 11:39:56.699 25631-25631/? W/System.err: at com.hans.robusttest.patch.MainHotpatchActivityPatch.onCreate(MainHotpatchActivityPatch.java:16) 2020-11-13 11:39:56.699 25631-25631/? W/System.err: at com.hans.robusttest.patch.MainHotpatchActivityPatchControl.accessDispatch(Unknown Source:75) 2020-11-13 11:39:56.699 25631-25631/? W/System.err: at com.meituan.robust.PatchProxy.accessDispatch(PatchProxy.java:9) 2020-11-13 11:39:56.699 25631-25631/? W/System.err: at com.meituan.robust.PatchProxy.proxy(PatchProxy.java:4) 2020-11-13 11:39:56.699 25631-25631/? W/System.err: at com.hans.robusttest.MainHotpatchActivity.onCreate(Unknown Source:20) 2020-11-13 11:39:56.699 25631-25631/? W/System.err: at android.app.Activity.performCreate(Activity.java:7893) 2020-11-13 11:39:56.699 25631-25631/? W/System.err: at android.app.Activity.performCreate(Activity.java:7880) 2020-11-13 11:39:56.699 25631-25631/? W/System.err: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1307) 2020-11-13 11:39:56.699 25631-25631/? W/System.err: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3286) 2020-11-13 11:39:56.700 25631-25631/? W/System.err: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3460) 2020-11-13 11:39:56.700 25631-25631/? W/System.err: at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83) 2020-11-13 11:39:56.700 25631-25631/? W/System.err: at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) 2020-11-13 11:39:56.700 25631-25631/? W/System.err: at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) 2020-11-13 11:39:56.700 25631-25631/? W/System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2047) 2020-11-13 11:39:56.700 25631-25631/? W/System.err: at android.os.Handler.dispatchMessage(Handler.java:107) 2020-11-13 11:39:56.700 25631-25631/? W/System.err: at android.os.Looper.loop(Looper.java:224) 2020-11-13 11:39:56.700 25631-25631/? W/System.err: at android.app.ActivityThread.main(ActivityThread.java:7584) 2020-11-13 11:39:56.700 25631-25631/? W/System.err: at java.lang.reflect.Method.invoke(Native Method) 2020-11-13 11:39:56.700 25631-25631/? W/System.err: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539) 2020-11-13 11:39:56.700 25631-25631/? W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950) 2020-11-13 11:39:56.700 25631-25631/? W/System.err: Caused by: java.lang.IllegalStateException: tvHot must not be null 2020-11-13 11:39:56.700 25631-25631/? W/System.err: at java.lang.reflect.Constructor.newInstance0(Native Method) 2020-11-13 11:39:56.700 25631-25631/? W/System.err: at java.lang.reflect.Constructor.newInstance(Constructor.java:343) 2020-11-13 11:39:56.700 25631-25631/? W/System.err: at com.meituan.robust.utils.EnhancedRobustUtils.invokeReflectConstruct(EnhancedRobustUtils.java:4) 2020-11-13 11:39:56.700 25631-25631/? W/System.err: at com.hans.robusttest.patch.IntrinsicsInLinePatch.checkExpressionValueIsNotNull(IntrinsicsInLinePatch.java:87) 2020-11-13 11:39:56.700 25631-25631/? W/System.err: ... 22 more 2020-11-13 11:39:56.700 25631-25631/? W/System.err: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Class java.lang.Object.getClass()' on a null object reference 2020-11-13 11:39:56.700 25631-25631/? W/System.err: at com.meituan.robust.utils.EnhancedRobustUtils.getDeclaredMethod(EnhancedRobustUtils.java:3) 2020-11-13 11:39:56.700 25631-25631/? W/System.err: at com.meituan.robust.utils.EnhancedRobustUtils.invokeReflectMethod(EnhancedRobustUtils.java:1) 2020-11-13 11:39:56.700 25631-25631/? W/System.err: at com.hans.robusttest.patch.MainHotpatchActivityPatch.onCreate(MainHotpatchActivityPatch.java:16) 2020-11-13 11:39:56.700 25631-25631/? W/System.err: at com.hans.robusttest.patch.MainHotpatchActivityPatchControl.accessDispatch(Unknown Source:75) 2020-11-13 11:39:56.700 25631-25631/? W/System.err: at com.meituan.robust.PatchProxy.accessDispatch(PatchProxy.java:9) 2020-11-13 11:39:56.700 25631-25631/? W/System.err: at com.meituan.robust.PatchProxy.proxy(PatchProxy.java:4) 2020-11-13 11:39:56.700 25631-25631/? W/System.err: at com.hans.robusttest.MainHotpatchActivity.onCreate(Unknown Source:20) 2020-11-13 11:39:56.700 25631-25631/? W/System.err: at android.app.Activity.performCreate(Activity.java:7893) 2020-11-13 11:39:56.700 25631-25631/? W/System.err: at android.app.Activity.performCreate(Activity.java:7880) 2020-11-13 11:39:56.700 25631-25631/? W/System.err: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1307) 2020-11-13 11:39:56.700 25631-25631/? W/System.err: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3286) 2020-11-13 11:39:56.700 25631-25631/? W/System.err: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3460) 2020-11-13 11:39:56.700 25631-25631/? W/System.err: at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83) 2020-11-13 11:39:56.700 25631-25631/? W/System.err: at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) 2020-11-13 11:39:56.700 25631-25631/? W/System.err: at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) 2020-11-13 11:39:56.700 25631-25631/? W/System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2047) 2020-11-13 11:39:56.700 25631-25631/? W/System.err: at android.os.Handler.dispatchMessage(Handler.java:107) 2020-11-13 11:39:56.700 25631-25631/? W/System.err: at android.os.Looper.loop(Looper.java:224) 2020-11-13 11:39:56.700 25631-25631/? W/System.err: at android.app.ActivityThread.main(ActivityThread.java:7584) 2020-11-13 11:39:56.700 25631-25631/? W/System.err: at java.lang.reflect.Method.invoke(Native Method) 2020-11-13 11:39:56.700 25631-25631/? W/System.err: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539) 2020-11-13 11:39:56.700 25631-25631/? W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950) 2020-11-13 11:39:56.706 11872-11872/? D/RecentsImpl: mActivityStateObserver com.hans.robusttest.MainHotpatchActivity
类文件:MainHotpatchActivity import androidx.appcompat.app.AppCompatActivity import android.os.Bundle import com.meituan.robust.patch.annotaion.Add import com.meituan.robust.patch.annotaion.Modify import kotlinx.android.synthetic.main.activity_main_hotpatch.*
class MainHotpatchActivity : AppCompatActivity() {
}