Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-15314] Android: Including borderRadius on animated view results in thread exit with uncaught exception

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2014-05-28T13:00:21.000+0000
Affected Version/sRelease 3.1.2, Release 3.1.3, Release 3.2.3
Fix Version/s2013 Sprint 22, 2013 Sprint 22 API, Release 3.2.0
ComponentsAndroid
Labelsmodule_animation, qe-3.2.0, qe-testadded, triage
ReporterEric Merriman
AssigneeSunila
Created2013-09-23T18:51:37.000+0000
Updated2014-05-28T13:00:21.000+0000

Description

This is not a regression - occurs in 3.1.2.GA

Description:

I was looking through the Q&A and found this report: http://developer.appcelerator.com/question/157464/not-animation-working-in-android-os-iphone-working I verified as stated that when including the borderRadius on the view, the application stops responding. This is output in the console:
[WARN][dalvikvm( 1143)] threadid=1: thread exiting with uncaught exception (group=0x40a71930)
[ERROR][TiApplication( 1143)] (main) [3427,3427] Sending event: exception on thread: main msg:java.lang.ClassCastException: android.widget.FrameLayout$LayoutParams cannot be cast to org.appcelerator.titanium.view.TiCompositeLayout$LayoutParams; Titanium 3.1.3,2013/09/18 12:01,222f4d1
[ERROR][TiApplication( 1143)] java.lang.ClassCastException: android.widget.FrameLayout$LayoutParams cannot be cast to org.appcelerator.titanium.view.TiCompositeLayout$LayoutParams
[ERROR][TiApplication( 1143)] 	at org.appcelerator.titanium.util.TiAnimationBuilder$AnimationListener.onAnimationEnd(TiAnimationBuilder.java:622)
[ERROR][TiApplication( 1143)] 	at android.view.animation.Animation.fireAnimationEnd(Animation.java:920)
[ERROR][TiApplication( 1143)] 	at android.view.animation.Animation.getTransformation(Animation.java:878)
[ERROR][TiApplication( 1143)] 	at android.view.animation.Animation.getTransformation(Animation.java:940)
[ERROR][TiApplication( 1143)] 	at android.view.animation.AnimationSet.getTransformation(AnimationSet.java:384)
[ERROR][TiApplication( 1143)] 	at android.view.animation.Animation.getTransformation(Animation.java:940)
[ERROR][TiApplication( 1143)] 	at android.view.View.drawAnimation(View.java:13205)
[ERROR][TiApplication( 1143)] 	at android.view.View.draw(View.java:13344)
[ERROR][TiApplication( 1143)] 	at android.view.ViewGroup.drawChild(ViewGroup.java:2928)
[ERROR][TiApplication( 1143)] 	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2797)
[ERROR][TiApplication( 1143)] 	at android.view.View.draw(View.java:13715)
[ERROR][TiApplication( 1143)] 	at android.widget.FrameLayout.draw(FrameLayout.java:467)
[ERROR][TiApplication( 1143)] 	at android.view.View.buildDrawingCache(View.java:12966)
[ERROR][TiApplication( 1143)] 	at android.view.View.draw(View.java:13400)
[ERROR][TiApplication( 1143)] 	at android.view.ViewGroup.drawChild(ViewGroup.java:2928)
[ERROR][TiApplication( 1143)] 	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2797)
[ERROR][TiApplication( 1143)] 	at org.appcelerator.titanium.view.TiCompositeLayout.dispatchDraw(TiCompositeLayout.java:646)
[ERROR][TiApplication( 1143)] 	at android.view.View.draw(View.java:13715)
[ERROR][TiApplication( 1143)] 	at android.view.View.draw(View.java:13596)
[ERROR][TiApplication( 1143)] 	at android.view.ViewGroup.drawChild(ViewGroup.java:2928)
[ERROR][TiApplication( 1143)] 	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2797)
[ERROR][TiApplication( 1143)] 	at org.appcelerator.titanium.view.TiCompositeLayout.dispatchDraw(TiCompositeLayout.java:646)
[ERROR][TiApplication( 1143)] 	at android.view.View.draw(View.java:13594)
[ERROR][TiApplication( 1143)] 	at android.view.ViewGroup.drawChild(ViewGroup.java:2928)
[ERROR][TiApplication( 1143)] 	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2797)
[ERROR][TiApplication( 1143)] 	at android.view.View.draw(View.java:13594)
[ERROR][TiApplication( 1143)] 	at android.view.ViewGroup.drawChild(ViewGroup.java:2928)
[ERROR][TiApplication( 1143)] 	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2797)
[ERROR][TiApplication( 1143)] 	at android.view.View.draw(View.java:13594)
[ERROR][TiApplication( 1143)] 	at android.view.ViewGroup.drawChild(ViewGroup.java:2928)
[ERROR][TiApplication( 1143)] 	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2797)
[ERROR][TiApplication( 1143)] 	at android.view.View.draw(View.java:13715)
[ERROR][TiApplication( 1143)] 	at android.widget.FrameLayout.draw(FrameLayout.java:467)
[ERROR][TiApplication( 1143)] 	at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:2211)
[ERROR][TiApplication( 1143)] 	at android.view.ViewRootImpl.drawSoftware(ViewRootImpl.java:2281)
[ERROR][TiApplication( 1143)] 	at android.view.ViewRootImpl.draw(ViewRootImpl.java:2177)
[ERROR][TiApplication( 1143)] 	at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2045)
[ERROR][TiApplication( 1143)] 	at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1854)
[ERROR][TiApplication( 1143)] 	at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:989)
[ERROR][TiApplication( 1143)] 	at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4351)
[ERROR][TiApplication( 1143)] 	at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
[ERROR][TiApplication( 1143)] 	at android.view.Choreographer.doCallbacks(Choreographer.java:562)
[ERROR][TiApplication( 1143)] 	at android.view.Choreographer.doFrame(Choreographer.java:532)
[ERROR][TiApplication( 1143)] 	at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
[ERROR][TiApplication( 1143)] 	at android.os.Handler.handleCallback(Handler.java:725)
[ERROR][TiApplication( 1143)] 	at android.os.Handler.dispatchMessage(Handler.java:92)
[ERROR][TiApplication( 1143)] 	at android.os.Looper.loop(Looper.java:137)
[ERROR][TiApplication( 1143)] 	at android.app.ActivityThread.main(ActivityThread.java:5041)
[ERROR][TiApplication( 1143)] 	at java.lang.reflect.Method.invokeNative(Native Method)
[ERROR][TiApplication( 1143)] 	at java.lang.reflect.Method.invoke(Method.java:511)
[ERROR][TiApplication( 1143)] 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
[ERROR][TiApplication( 1143)] 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
[ERROR][TiApplication( 1143)] 	at dalvik.system.NativeStart.main(Native Method)
[ERROR][AndroidRuntime( 1143)] FATAL EXCEPTION: main
[ERROR][AndroidRuntime( 1143)] java.lang.ClassCastException: android.widget.FrameLayout$LayoutParams cannot be cast to org.appcelerator.titanium.view.TiCompositeLayout$LayoutParams
[ERROR][AndroidRuntime( 1143)] 	at org.appcelerator.titanium.util.TiAnimationBuilder$AnimationListener.onAnimationEnd(TiAnimationBuilder.java:622)
[ERROR][AndroidRuntime( 1143)] 	at android.view.animation.Animation.fireAnimationEnd(Animation.java:920)
[ERROR][AndroidRuntime( 1143)] 	at android.view.animation.Animation.getTransformation(Animation.java:878)
[ERROR][AndroidRuntime( 1143)] 	at android.view.animation.Animation.getTransformation(Animation.java:940)
[ERROR][AndroidRuntime( 1143)] 	at android.view.animation.AnimationSet.getTransformation(AnimationSet.java:384)
[ERROR][AndroidRuntime( 1143)] 	at android.view.animation.Animation.getTransformation(Animation.java:940)
[ERROR][AndroidRuntime( 1143)] 	at android.view.View.drawAnimation(View.java:13205)
[ERROR][AndroidRuntime( 1143)] 	at android.view.View.draw(View.java:13344)
[ERROR][AndroidRuntime( 1143)] 	at android.view.ViewGroup.drawChild(ViewGroup.java:2928)
[ERROR][AndroidRuntime( 1143)] 	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2797)
[ERROR][AndroidRuntime( 1143)] 	at android.view.View.draw(View.java:13715)
[ERROR][AndroidRuntime( 1143)] 	at android.widget.FrameLayout.draw(FrameLayout.java:467)
[ERROR][AndroidRuntime( 1143)] 	at android.view.View.buildDrawingCache(View.java:12966)
[ERROR][AndroidRuntime( 1143)] 	at android.view.View.draw(View.java:13400)
[ERROR][AndroidRuntime( 1143)] 	at android.view.ViewGroup.drawChild(ViewGroup.java:2928)
[ERROR][AndroidRuntime( 1143)] 	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2797)
[ERROR][AndroidRuntime( 1143)] 	at org.appcelerator.titanium.view.TiCompositeLayout.dispatchDraw(TiCompositeLayout.java:646)
[ERROR][AndroidRuntime( 1143)] 	at android.view.View.draw(View.java:13715)
[ERROR][AndroidRuntime( 1143)] 	at android.view.View.draw(View.java:13596)
[ERROR][AndroidRuntime( 1143)] 	at android.view.ViewGroup.drawChild(ViewGroup.java:2928)
[ERROR][AndroidRuntime( 1143)] 	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2797)
[ERROR][AndroidRuntime( 1143)] 	at org.appcelerator.titanium.view.TiCompositeLayout.dispatchDraw(TiCompositeLayout.java:646)
[ERROR][AndroidRuntime( 1143)] 	at android.view.View.draw(View.java:13594)
[ERROR][AndroidRuntime( 1143)] 	at android.view.ViewGroup.drawChild(ViewGroup.java:2928)
[ERROR][AndroidRuntime( 1143)] 	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2797)
[ERROR][AndroidRuntime( 1143)] 	at android.view.View.draw(View.java:13594)
[ERROR][AndroidRuntime( 1143)] 	at android.view.ViewGroup.drawChild(ViewGroup.java:2928)
[ERROR][AndroidRuntime( 1143)] 	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2797)
[ERROR][AndroidRuntime( 1143)] 	at android.view.View.draw(View.java:13594)
[ERROR][AndroidRuntime( 1143)] 	at android.view.ViewGroup.drawChild(ViewGroup.java:2928)
[ERROR][AndroidRuntime( 1143)] 	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2797)
[ERROR][AndroidRuntime( 1143)] 	at android.view.View.draw(View.java:13715)
[ERROR][AndroidRuntime( 1143)] 	at android.widget.FrameLayout.draw(FrameLayout.java:467)
[ERROR][AndroidRuntime( 1143)] 	at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:2211)
[ERROR][AndroidRuntime( 1143)] 	at android.view.ViewRootImpl.drawSoftware(ViewRootImpl.java:2281)
[ERROR][AndroidRuntime( 1143)] 	at android.view.ViewRootImpl.draw(ViewRootImpl.java:2177)
[ERROR][AndroidRuntime( 1143)] 	at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2045)
[ERROR][AndroidRuntime( 1143)] 	at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1854)
[ERROR][AndroidRuntime( 1143)] 	at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:989)
[ERROR][AndroidRuntime( 1143)] 	at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4351)
[ERROR][AndroidRuntime( 1143)] 	at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
[ERROR][AndroidRuntime( 1143)] 	at android.view.Choreographer.doCallbacks(Choreographer.java:562)
[ERROR][AndroidRuntime( 1143)] 	at android.view.Choreographer.doFrame(Choreographer.java:532)
[ERROR][AndroidRuntime( 1143)] 	at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
[ERROR][AndroidRuntime( 1143)] 	at android.os.Handler.handleCallback(Handler.java:725)
[ERROR][AndroidRuntime( 1143)] 	at android.os.Handler.dispatchMessage(Handler.java:92)
[ERROR][AndroidRuntime( 1143)] 	at android.os.Looper.loop(Looper.java:137)
[ERROR][AndroidRuntime( 1143)] 	at android.app.ActivityThread.main(ActivityThread.java:5041)
[ERROR][AndroidRuntime( 1143)] 	at java.lang.reflect.Method.invokeNative(Native Method)
[ERROR][AndroidRuntime( 1143)] 	at java.lang.reflect.Method.invoke(Method.java:511)
[ERROR][AndroidRuntime( 1143)] 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
[ERROR][AndroidRuntime( 1143)] 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
[ERROR][AndroidRuntime( 1143)] 	at dalvik.system.NativeStart.main(Native Method)
[WARN][ActivityManager(  350)]   Force finishing activity com.appc.fromtheQA/org.appcelerator.titanium.TiActivity

Sample code

var win = Ti.UI.createWindow({
	backgroundColor : '#4b4276',
	navBarHidden : true,
});

var animateLeft = Ti.UI.createAnimation({
	top : 200,
	duration : 400,
});

var loginView = Ti.UI.createView({
	height : 50,
	width : 200,
	top : 0,
	// comment out the line below or this will fail on Android
	borderRadius : 10
});

var txtUserName = Ti.UI.createTextField({
	backgroundColor : '#fff',
	hintText : 'Password',
	width : 150,
	height : 50,
	left : 0,
	font : {
		fontFamily : 'OpenSans-Light',
	},
	textAlign : Ti.UI.TEXT_ALIGNMENT_CENTER,
});
loginView.add(txtUserName);
var btnUserLogin = Ti.UI.createButton({
	backgroundImage : 'none',
	backgroundColor : '#92cf5c',
	font : {
		fontFamily : 'OpenSans-Light',
	},
	color : '#ffffff',
	title : 'OK',
	width : 50,
	height : 50,
	right : 0,
});

loginView.add(btnUserLogin);

win.addEventListener('open', function() {
	if (Ti.Platform.osname == 'android') {
		setTimeout(function() {
			loginView.animate(animateLeft);
		}, 1000);
	} else if (Ti.Platform.osname == 'iphone') {
		loginView.animate(animateLeft);
	}

});

win.add(loginView);

win.open();

Steps to reproduce:

1) Create a project with the sample code above 2) Run on Android emulator

Result:

The app will crash with the output in the console as shown above. If you comment-out the borderRadius, the code will run as expected.

Expected Result:

The view animates as expected.

Comments

  1. Sunila 2013-10-10

    If the parent is border view, set the layout params to the border view. https://github.com/appcelerator/titanium_mobile/pull/4778
  2. Hieu Pham 2013-10-13

  3. Wilson Luu 2013-10-18

    Closing ticket as fixed. Verified the animation moves downward. Tested on: Titanium Studio, build: 3.2.0.201310180511 OS: Mac OS X Mountain Lion (10.8.5) SDK build: 3.2.0.v20131018121230 Devices: Samsung Galaxy S3 (4.0.4), iphone 5 (7.0.2)
  4. Paras Mishra 2014-03-13

    Animation does not work properly, textfield disappears in 1 second after running the app.After commenting the borderRadius property of View, animation works fine. Issue occurs on Android Devices, It works fine on iOS. Environment used: Device : Google Nexus 7, Android Version: 4.3 Device : Google Nexus 4, Android Version: 4.1.1 SDK: 3.2.3.v20140311115447 CLI version : 3.2.1 OS : MAC OSX 10.9 Alloy: 1.3.1 ACS: 1.0.14 npm:1.3.2 Appcelerator Studio, build: 3.2.2.201403061827 titanium-code-processor: 1.1.0 XCode : 5.1
  5. Sunila 2014-03-13

    Please see the comments in the pull request. Hieu has created TIMOB-15471 to track this specific issue for > Honeycomb versions.
  6. Kajenthiran Velummaylum 2014-05-20

    *Bug is not reproducible*. Animation works as expected with the sample code. (with borderRadius property) Test Environment: || *Component* || *Version* || | Appcelerator Studio | 3.3.0.201405161313 | | Titanium SDK | 3.3.0.v20140516180912 | | Alloy | 1.4.0-alpha | | CLI | 3.3.0-alpha3 | | ACS | 1.0.14 | | NPM | 1.4.10 | | Titanium-Code-Processor | 1.1.1 | | Node-ACS | 1.0.14 | | OS | OS X 10.9.2 |
  7. Lokesh Choudhary 2014-05-22

    Verified the fix. Having "borderRadius" property does not crash the app. Closing. Environment: Appc Studio : 3.3.0.201405211748 Ti SDK : 3.3.0.v20140521174951 Mac OSX : 10.8.5 Alloy : 1.4.0-alpha2 CLI - 3.3.0-alpha5 Code Processor: 1.1.1 Samsung Galaxy S4 running android 4.2.2
  8. Ingo Muschenetz 2014-05-28

    Removed sprint

JSON Source