Native crashes on abort in developer console with Oreo (8.1)

前端 未结 2 1251
执念已碎
执念已碎 2020-12-13 18:32

In the developer console I get more and more a native crash in abort. This occurs ONLY for android 8.1 device! Is anybody aware of a regression? Here is the backtrace:

相关标签:
2条回答
  • 2020-12-13 19:09

    that a Surface is being used hints for OpenGL ES and GLSurfaceView - which extends View.

    a possible workaround might be to disable hardware acceleration for the views, which cause it to crash on Android 8.1 and 9.0 (as libhwui.so hints for) - because even if it gets fixed, any device not updated will still keep crashing. this can be done per View (see the documentation):

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
        mSurface.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    }
    

    of course, this would result in sub-optimal performance; but still better than a crash.

    0 讨论(0)
  • 2020-12-13 19:10

    Check out this answer:

    tgkill - native error on Android 8.0 Samsung S8

    It seems it might be related to Samsung S8 and Samsung S8+.

    Basically, if you have an edit text in a dialog or dialog fragment, highlight the text and then close the dialog (or do an orientation change) this crash will occur.

    To resolve the issue, I had to turn off hardwareAcceleration on the offending activities - this can be done in the manifest and will cause the activity to lag a bit.

       <activity android:name=".activities.CarDamageActivity"
               android:hardwareAccelerated="false" />
    

    To help prevent the lag on OTHER devices, one can check the device model and if it is NOT a S8 or S8+, turn ON the hardware acceleration.

        String phoneMake =  Build.MANUFACTURER;
        String phoneModel =  Build.MODEL.toUpperCase();
        if (!(phoneMake.equalsIgnoreCase("samsung") && (phoneModel.startsWith("SM-G950")
                ||  phoneModel.startsWith("SM-G955")))) {
            window.setFlags(
                    WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
                    WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);
        }
    
    0 讨论(0)
提交回复
热议问题