Android Crash问题

-- TimeoutException: com.android.org.conscrypt.OpenSSLDigestContext.finalize() timed out after 120 seconds- https://github.com/google/conscrypt/issues/546
  https://github.com/google/conscrypt/issues/378
  TimeoutException: android.media.SoundPool.finalize() timed out after 10 seconds

-- java.lang.OutOfMemoryError: Could not allocate JNI Env
  OkHttp OutOfMemoryError: Could not allocate JNI Env , OkHttp出现内存泄漏 Android
  解决retrofit OKhttp创建大量对外连接时内存溢出- https://blog.csdn.net/tianyaleixiaowu/article/details/78811488
OutOfMemoryError: Coldnot not allocate JNI Env- https://blog.csdn.net/baidu_40389775/article/details/86421119

-- java.lang.IllegalStateException: Fragment not attached to Activity,这类bug产生的现象就是在Fragment还没添加到Activity中时,去调用了Fragment的getResources().getString(R.string.xxx)这样的函数。
原因:Fragment被添加到Activity之前,如果去调用了Fragment的某些函数就会导致这个异常出现。
解决方案:在出现问题的地方加入Fragment是否添加到Activity的判断:
if(Fragment.isAdded()) {
    text = getResources().getString(R.string.xxx);
}
if(isAdded()){
  list_play.setImageBitmap(BitmapFactory.decodeResource(getResources(),R.drawable.play));
}

-- 8.0上使用webView碰到以上ANR的问题,HONOR_MYA-AL10Android6.0
 Also I should point I can't reproduce it on 5.0 devices so it is not something that is happening all the time, just sometimes. I guess it could be that the WebView might have changed on 5.0 so that some event is now on the UI thread and it didn't use to be but that seems odd considering I can't reproduce it and it happens intermittently. 

Android layer type与WebView白屏以及WebView不随动画而动的问题- https://blog.csdn.net/a345017062/article/details/7478667

TimeoutException: android.view.ThreadedRenderer.finalize() timed out after 30 seconds
if (Build.VERSION.SDK_INT >= 19) {
  webView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);// KITKAT
}
最简单的解决方法是在清单文件中添加hardwareAccelerated(控制硬件加速)属性:
<application
    android:name=".LiApplication"
    android:allowBackup="true"
    android:icon="@drawable/logo"
    android:label="@string/home_name"  
    android:theme="@style/ThemeNow_GridView"
    android:hardwareAccelerated="false"
    tools:replace="android:name" >
 </application>

<activity  
    android:name="icyfox.webviewimagezoomertest.MainActivity"  
    android:label="@string/app_name"  
    android:hardwareAccelerated="false"  />

LAYER_TYPE_SOFTWARE
无论硬件加速是否打开,都会有一张Bitmap(software layer),并在上面对WebView进行软渲染。
好处:
在进行动画,使用software可以只画一次View树,很省。
什么时候不要用:
View树经常更新时不要用。尤其是在硬件加速打开时,每次更新消耗的时间更多。因为渲染完这张Bitmap后还需要再把这张Bitmap渲染到hardware layer上面去。

LAYER_TYPE_HARDWARE
硬件加速关闭时,作用同software。
硬件加速打开时会在FBO(Framebuffer Object)上面做渲染,在进行动画时,View树也只需要画一次。

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        webview.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    }
WebView白屏,当webview有变化,需要更新时,小米手机都会有这个问题,WebView   设置 android:layerType="software" 就好了。

view可以使用以下三个类型之一:
• LAYER_TYPE_NONE:view按一般方式绘制,不使用离屏缓冲.这是默认的行为.
• LAYER_TYPE_HARDWARE:如果应用被硬加速了,view会被绘制到一个硬件纹理中.如果应用没被硬加速,此类型的layer的行为同于LAYER_TYPE_SOFTWARE.
• LAYER_TYPE_SOFTWARE:view被绘制到一个bitmap中.

I am getting this strange crash reports on Lollipop. 

猜你喜欢

转载自blog.csdn.net/ShareUs/article/details/88085031