Qihoo360 / RePlugin

RePlugin - A flexible, stable, easy-to-use Android Plug-in Framework
Apache License 2.0
7.27k stars 1.53k forks source link

EditText输入内容后,再次获取焦点输入,插件崩溃 #1001

Closed userfuy closed 3 years ago

userfuy commented 3 years ago

问题详细描述 Detailed description of the problem

EditText输入内容后,再次获取焦点输入,插件崩溃。 手机升级Android 10最新版本后,问题出现,升级前的Android 10系统无问题。

复现问题步骤 Steps to reproduce the problem

  1. EditText输入内容;
  2. 再次获取焦点输入,插件崩溃

其它重要信息 Other important information

replugin-host-lib/gradle Version: rePlugin-plugin-lib/gradle Version:

Android API Version: Android 手机型号&ROM(Phone model & ROM):

Logcat上下文 Logcat context

04-14 14:59:36.369 7935 7935 E CrashReporter: 04-14 14:59:36.379 7935 7935 E CrashReporter: [EXCEPTION] 04-14 14:59:36.389 7935 7935 E CrashReporter: Name: Resource ID #0x0 04-14 14:59:36.399 7935 7935 E CrashReporter: Reason: android.content.res.Resources$NotFoundException: Resource ID #0x0 04-14 14:59:36.419 7935 7935 E CrashReporter: Process ID: 7935 04-14 14:59:36.429 7935 7935 E CrashReporter: Thread: 7935 (main) 04-14 14:59:36.440 7935 7935 E CrashReporter: Call Stack 1: android.content.res.ResourcesImpl.getValueForDensity(ResourcesImpl.java:404) 04-14 14:59:36.450 7935 7935 E CrashReporter: Call Stack 2: android.content.res.Resources.getDrawableForDensity(Resources.java:1004) 04-14 14:59:36.460 7935 7935 E CrashReporter: Call Stack 3: android.content.res.Resources.getDrawable(Resources.java:944) 04-14 14:59:36.470 7935 7935 E CrashReporter: Call Stack 4: library.d.getDrawable(Unknown Source:13) 04-14 14:59:36.480 7935 7935 E CrashReporter: Call Stack 5: android.content.Context.getDrawable(Context.java:687) 04-14 14:59:36.490 7935 7935 E CrashReporter: Call Stack 6: android.widget.TextView.getTextSelectHandle(TextView.java:3727) 04-14 14:59:36.500 7935 7935 E CrashReporter: Call Stack 7: android.widget.Editor.loadHandleDrawables(Editor.java:7792) 04-14 14:59:36.511 7935 7935 E CrashReporter: Call Stack 8: android.widget.Editor$InsertionPointCursorController.getHandle(Editor.java:7233) 04-14 14:59:36.521 7935 7935 E CrashReporter: Call Stack 9: android.widget.Editor$InsertionPointCursorController.show(Editor.java:7212) 04-14 14:59:36.531 7935 7935 E CrashReporter: Call Stack 10: android.widget.Editor.onTouchUpEvent(Editor.java:2623) 04-14 14:59:36.541 7935 7935 E CrashReporter: Call Stack 11: android.widget.TextView.onTouchEvent(TextView.java:11185) 04-14 14:59:36.551 7935 7935 E CrashReporter: Call Stack 12: android.view.View.dispatchTouchEvent(View.java:13665) 04-14 14:59:36.561 7935 7935 E CrashReporter: Call Stack 13: android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3249) 04-14 14:59:36.571 7935 7935 E CrashReporter: Call Stack 14: android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2938) 04-14 14:59:36.582 7935 7935 E CrashReporter: Call Stack 15: android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3249) 04-14 14:59:36.592 7935 7935 E CrashReporter: Call Stack 16: android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2938) 04-14 14:59:36.602 7935 7935 E CrashReporter: Call Stack 17: android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3249) 04-14 14:59:36.612 7935 7935 E CrashReporter: Call Stack 18: android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2938) 04-14 14:59:36.623 7935 7935 E CrashReporter: Call Stack 19: android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3249) 04-14 14:59:36.633 7935 7935 E CrashReporter: Call Stack 20: android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2938)

chwnFlyPig commented 3 years ago

是华为的鸿蒙手机吗?我这边也遇到了这个问题。你先把PluginResource的逻辑去掉试一下,就是插件基类里去掉getResources方法里的使用PluginResource的逻辑。

AdminQQZ commented 3 years ago

拒绝鸿蒙,从你开始

sadikelong commented 3 years ago

继承EditText重写一下崩溃的方法就行了,设置正确的上下文即可。 android.widget.TextView.getTextSelectHandle(TextView.java:3727)这个方法是android10的一本版本引入的,之前没有。 很小的问题。

userfuy commented 3 years ago

修改方案: https://github.com/shensky711/RePlugin/commit/f1be6db329599964274cad1628a1d6fe39509a53

lioilwin commented 3 years ago

@userfuy @shensky711 非常感谢,很好解决了这个问题。

shadow520 commented 2 years ago

是华为的鸿蒙手机吗?我这边也遇到了这个问题。你先把PluginResource的逻辑去掉试一下,就是插件基类里去掉getResources方法里的使用PluginResource的逻辑。

你好,请问这个怎么修改插件基类呢?

shadow520 commented 2 years ago

@userfuy @shensky711 非常感谢,很好解决了这个问题。

你好,请问你这个问题是怎么解决的呢,我发现这个修改的代码并没有合入

shadow520 commented 2 years ago

修改方案: hanschencoder@f1be6db

你好,这个请求没有合并,怎么办呢?

hanschencoder commented 2 years ago

修改方案: hanschencoder@f1be6db

你好,这个请求没有合并,怎么办呢?

自己编一个~这项目估计也不维护了

userfuy commented 2 years ago

不修改Replugin的解决方案: 1、Application中注册Activity监听registerActivityLifecycleCallbacks(this); 2、监听页面创建前修改Bundle内容,删除恢复fragment信息,防止页面重建时崩溃 @Override public void onActivityPreCreated(@NonNull Activity activity, @Nullable Bundle savedInstanceState) { if (null != savedInstanceState) { savedInstanceState.setClassLoader(activity.getClassLoader()); removeFragmentsState(savedInstanceState); } }

protected void removeFragmentsState(@Nullable Bundle bundle) {
    if (bundle == null) {
        return;
    }
    bundle.remove("android:support:fragments");
    bundle.remove("android:fragments");
    Set<String> keySet = bundle.keySet();
    for (String key : keySet) {
        Object next = bundle.get(key);
        if (next != null && next instanceof Bundle) {
            removeFragmentsState((Bundle) next);
        }
    }
}
shadow520 commented 2 years ago

自己怎么编呀?可以加你QQ指导一下吗~~

------------------ 原始邮件 ------------------ 发件人: @.>; 发送时间: 2022年5月13日(星期五) 下午5:03 收件人: @.>; 抄送: @.>; @.>; 主题: Re: [Qihoo360/RePlugin] EditText输入内容后,再次获取焦点输入,插件崩溃 (#1001)

修改方案: @.***

你好,这个请求没有合并,怎么办呢?

自己编一个~这项目估计也不维护了

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>