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

插件中的webview去加载带有video标签的页面时就会发生崩溃 #943

Closed Guangdinghou closed 4 years ago

Guangdinghou commented 4 years ago

问题详细描述 Detailed description of the problem

Android 9 10 系统中,插件中的webview去加载带有video标签的页面时就会发生崩溃。(Android7和8暂未尝试) Android 6中正常

复现问题步骤 Steps to reproduce the problem

  1. 插件中使用webview加载带有video标签的页面
  2. 崩溃

其它重要信息 Other important information

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

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

Logcat上下文 Logcat context

错误日志:

2020-04-09 12:07:13.504 4458-4458/com.n22.jzyx E/2.jzy: No package ID 02 found for ID 0x0206005a.
2020-04-09 12:07:13.504 4458-4458/com.n22.jzyx W/System.err: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference
2020-04-09 12:07:13.505 4458-4458/com.n22.jzyx W/System.err:     at po.run(PG:8)
2020-04-09 12:07:13.505 4458-4458/com.n22.jzyx W/System.err:     at android.os.MessageQueue.nativePollOnce(Native Method)
2020-04-09 12:07:13.505 4458-4458/com.n22.jzyx W/System.err:     at android.os.MessageQueue.next(MessageQueue.java:336)
2020-04-09 12:07:13.506 4458-4458/com.n22.jzyx W/System.err:     at android.os.Looper.loop(Looper.java:174)
2020-04-09 12:07:13.506 4458-4458/com.n22.jzyx W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:7356)
2020-04-09 12:07:13.506 4458-4458/com.n22.jzyx W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
2020-04-09 12:07:13.506 4458-4458/com.n22.jzyx W/System.err:     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
2020-04-09 12:07:13.506 4458-4458/com.n22.jzyx W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
2020-04-09 12:07:13.514 4458-4458/com.n22.jzyx A/chromium: [FATAL:jni_android.cc(249)] Please include Java exception stack in crash report
2020-04-09 12:07:14.089 4458-4458/com.n22.jzyx A/libc: Fatal signal 5 (SIGTRAP), code 0 (SI_USER) in tid 4458 (2.jzyx), pid 4458 (2.jzyx)
Guangdinghou commented 4 years ago

已解决。 重写 WebChromeClient 的getDefaultVideoPoster方法

public Bitmap getDefaultVideoPoster() {
        if (super.getDefaultVideoPoster() == null) {
            return BitmapFactory.decodeResource(mContext.getResources(), R.mipmap.temp);
        }
        return super.getDefaultVideoPoster();
    }