diff --git a/tns-core-modules/ui/animation/animation.android.ts b/tns-core-modules/ui/animation/animation.android.ts index 58cc98df1..826621601 100644 --- a/tns-core-modules/ui/animation/animation.android.ts +++ b/tns-core-modules/ui/animation/animation.android.ts @@ -376,18 +376,20 @@ export class Animation extends common.Animation implements definition.Animation private _enableHardwareAcceleration() { for (let i = 0, length = this._propertyAnimations.length; i < length; i++) { let cache = this._propertyAnimations[i].target._nativeView; - let layerType = cache.getLayerType(); - if (layerType !== android.view.View.LAYER_TYPE_HARDWARE) { - cache.layerType = layerType; - cache.setLayerType(android.view.View.LAYER_TYPE_HARDWARE, null); - } + if (cache){ + let layerType = cache.getLayerType(); + if (layerType !== android.view.View.LAYER_TYPE_HARDWARE) { + cache.layerType = layerType; + cache.setLayerType(android.view.View.LAYER_TYPE_HARDWARE, null); + } + } } } private _disableHardwareAcceleration() { for (let i = 0, length = this._propertyAnimations.length; i < length; i++) { let cache = this._propertyAnimations[i].target._nativeView; - if (cache.layerType !== undefined) { + if (cache && cache.layerType !== undefined) { cache.setLayerType(cache.layerType, null); cache.layerType = undefined; }