Skip to content Skip to sidebar Skip to footer

Custom Keyboard Not Working On Android P Beta

When I try to use Custom Keyboard got an exception on Android P Beta, everything is working fine until Android Oreo but recently got a crash. Just try to figure out which class mig

Solution 1:

It actually tells you the reason:

only INTERSECT and DIFFERENCE are allowed

The reason is written here:

This method was deprecated in API level 26. Region.Op values other than INTERSECT and DIFFERENCE have the ability to expand the clip. The canvas clipping APIs are intended to only expand the clip as a result of a restore operation. This enables a view parent to clip a canvas to clearly define the maximal drawing area of its children. The recommended alternative calls are clipRect(RectF) and clipOutRect(RectF); As of API Level API level Build.VERSION_CODES.P only INTERSECT and DIFFERENCE are valid Region.Op parameters.

So you either have to use lower targetSdk version (which you shouldn't, because Google will force you to use at least 26 it by the end of the year), or you fix it by using your clipping via the canvas in a different way.

I've asked a question about it here, of what's the alternative.

Solution 2:

you just need to remove this line :

.setCropShape(CropImageView.CropShape.OVAL)

Post a Comment for "Custom Keyboard Not Working On Android P Beta"