Webveiw 的 WebViewContentsClientAdapter 获取bitmap 宽高 时 bitmap 空指针

android6.0版本WebView使用video标签播放视频poster设置为assets下的图片报空指针

Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference

getDefaultPoster...

解决方法:

Here's a workaround for the problem:

Add to your MainActivity:

@Override
public AssetManager getAssets() {
    return getResources().getAssets();
}

we know what's causing this, but fixing it is non-trivial at this point in M development. The workaround should be ok though.

chrome 官方的规避方案
https://bugs.chromium.org/p/c...

 

 

你可能感兴趣的:(android)