Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-16906] Android : An empty scrollableview causes the app to crash

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2014-05-12T21:16:08.000+0000
Affected Version/sRelease 3.2.3
Fix Version/s2014 Sprint 10, 2014 Sprint 10 SDK, Release 3.3.0
ComponentsAndroid
Labelsmerge-3.2.4, module_scrollableview, qe-3.2.3, qe-3.3.0, qe-closed-3.3.0, qe-testadded
ReporterLokesh Choudhary
AssigneeHieu Pham
Created2014-05-02T17:41:46.000+0000
Updated2014-05-13T18:17:57.000+0000

Description

This is a regression. It works as expected with 3.2.2.GA

Description:

1. Create an classic app & use the code below in the app.js.
var win = Ti.UI.createWindow({
backgroundColor: 'white',
title: "ScrollableView Test"
});

var sav = Ti.UI.createScrollableView();

win.add(sav);

win.open();
3. Build that app for device/emulator.

Actual Result:

1. The app crashes & we get the following logs in console:
[ERROR] :  TiApplication: (main) [335,335] Sending event: exception on thread: main msg:java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0; Titanium 3.2.3,2014/04/22 10:17,b958a70
[ERROR] :  TiApplication: java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0
[ERROR] :  TiApplication: 	at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:251)
[ERROR] :  TiApplication: 	at java.util.ArrayList.get(ArrayList.java:304)
[ERROR] :  TiApplication: 	at ti.modules.titanium.ui.widget.TiUIScrollableView$2.onPageScrolled(TiUIScrollableView.java:192)
[ERROR] :  TiApplication: 	at android.support.v4.view.ViewPager.onPageScrolled(ViewPager.java:1712)
[ERROR] :  TiApplication: 	at android.support.v4.view.ViewPager.pageScrolled(ViewPager.java:1633)
[ERROR] :  TiApplication: 	at android.support.v4.view.ViewPager.scrollToItem(ViewPager.java:581)
[ERROR] :  TiApplication: 	at android.support.v4.view.ViewPager.onLayout(ViewPager.java:1600)
[ERROR] :  TiApplication: 	at android.view.View.layout(View.java:14482)
[ERROR] :  TiApplication: 	at android.view.ViewGroup.layout(ViewGroup.java:4469)
[ERROR] :  TiApplication: 	at org.appcelerator.titanium.view.TiCompositeLayout.onLayout(TiCompositeLayout.java:578)
[ERROR] :  TiApplication: 	at android.view.View.layout(View.java:14482)
[ERROR] :  TiApplication: 	at android.view.ViewGroup.layout(ViewGroup.java:4469)
[ERROR] :  TiApplication: 	at org.appcelerator.titanium.view.TiCompositeLayout.onLayout(TiCompositeLayout.java:578)
[ERROR] :  TiApplication: 	at android.view.View.layout(View.java:14482)
[ERROR] :  TiApplication: 	at android.view.ViewGroup.layout(ViewGroup.java:4469)
[ERROR] :  TiApplication: 	at org.appcelerator.titanium.view.TiCompositeLayout.onLayout(TiCompositeLayout.java:578)
[ERROR] :  TiApplication: 	at android.view.View.layout(View.java:14482)
[ERROR] :  TiApplication: 	at android.view.ViewGroup.layout(ViewGroup.java:4469)
[ERROR] :  TiApplication: 	at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
[ERROR] :  TiApplication: 	at android.view.View.layout(View.java:14482)
[ERROR] :  TiApplication: 	at android.view.ViewGroup.layout(ViewGroup.java:4469)
[ERROR] :  TiApplication: 	at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1669)
[ERROR] :  TiApplication: 	at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1527)
[ERROR] :  TiApplication: 	at android.widget.LinearLayout.onLayout(LinearLayout.java:1440)
[ERROR] :  TiApplication: 	at android.view.View.layout(View.java:14482)
[ERROR] :  TiApplication: 	at android.view.ViewGroup.layout(ViewGroup.java:4469)
[ERROR] :  TiApplication: 	at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
[ERROR] :  TiApplication: 	at android.view.View.layout(View.java:14482)
[ERROR] :  TiApplication: 	at android.view.ViewGroup.layout(ViewGroup.java:4469)
[ERROR] :  TiApplication: 	at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2147)
[ERROR] :  TiApplication: 	at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1966)
[ERROR] :  TiApplication: 	at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1179)
[ERROR] :  TiApplication: 	at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4859)
[ERROR] :  TiApplication: 	at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
[ERROR] :  TiApplication: 	at android.view.Choreographer.doCallbacks(Choreographer.java:562)
[ERROR] :  TiApplication: 	at android.view.Choreographer.doFrame(Choreographer.java:532)
[ERROR] :  TiApplication: 	at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
[ERROR] :  TiApplication: 	at android.os.Handler.handleCallback(Handler.java:725)
[ERROR] :  TiApplication: 	at android.os.Handler.dispatchMessage(Handler.java:92)
[ERROR] :  TiApplication: 	at android.os.Looper.loop(Looper.java:137)
[ERROR] :  TiApplication: 	at android.app.ActivityThread.main(ActivityThread.java:5328)
[ERROR] :  TiApplication: 	at java.lang.reflect.Method.invokeNative(Native Method)
[ERROR] :  TiApplication: 	at java.lang.reflect.Method.invoke(Method.java:511)
[ERROR] :  TiApplication: 	at
[ERROR] :  TiApplication: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
[ERROR] :  TiApplication: 	at dalvik.system.NativeStart.main(Native Method)

Expected Results:

1. The app should not crash when an empty scrollable view is added.

Comments

  1. Malcolm Hollingsworth 2014-05-02

    Originally experienced by; Stephen Hickey in the Q&A http://developer.appcelerator.com/question/173788
  2. Hieu Pham 2014-05-02

    This is working for 3.2.2.GA, and start failing in 3.2.3.GA. This seems to be a side effect of upgrading our v4 library in 3.2.3.GA. The scrollableView code in v4 is triggering onPageScrolled during the layout pass. I will add a safety check in SDK
  3. Ingo Muschenetz 2014-05-02

    Thanks. let's merge this back to 3.2.X CI for affected users
  4. Hieu Pham 2014-05-05

    master PR: https://github.com/appcelerator/titanium_mobile/pull/5659 3.2.X PR: https://github.com/appcelerator/titanium_mobile/pull/5660
  5. Vishal Duggal 2014-05-08

    PRs merged
  6. Neha Mittal 2014-05-09

    I am able to reproduce the mentioned issue with studio: 3.3.0.201405080918 and SDK: 3.3.0.v20140508135704 with below environment: Appc Studio: 3.3.0.201405080918 SDK build: 3.3.0.v20140508135704 acs: 1.0.14 npm: 1.3.2 alloy: 1.4.0-dev CLI: titanium-3.3.0-dev titanium-code-processor:1.1.1 Xcode: 5.1.1 Osx: Mavericks(10.9.2) Device: Galaxy Nexus (4.1.1) However, if I am verifying the same using studio: 3.2.3.201404290818 and SDK: 3.3.0.v20140508135704, then it is working fine and app does not get crash. Hence reopening the issue.
  7. Lokesh Choudhary 2014-05-09

    Tried to reproduce after [~nmittal] reopened the issue. I have the following observations:

    With studio 3.3.0.201405080918 & sdk 3.3.0.v20140508223312:

    Could not reproduce app did not crash

    With studio 3.2.3.201404181520(current 3.2.3 GA studio) & sdk 3.3.0.v20140508223312:

    Could not reproduce app did not crash

    With studio 3.3.0.201405080918 & sdk 3.2.4.v20140508113321:

    Could not reproduce app did not crash Environment: Appc Studio : 3.3.0.201405080918 , 3.2.3.201404181520 Ti SDK : 3.3.0.v20140508223312 , 3.2.4.v20140508113321 Mac OSX : 10.8.5 , mavericks (10.9.2) Alloy : 1.4.0-dev CLI - 3.3.0-dev Samsung Galaxy S4 running android 4.2.2 Nexus 5 - android 4.4.2
  8. Neha Mittal 2014-05-13

    Verified fix using below environment: Appc Studio: 3.3.0.201405121247 SDK build: 3.3.0.v20140512162513 acs: 1.0.14 npm: 1.3.2 alloy: 1.4.0-dev CLI: titanium-3.3.0-dev titanium-code-processor:1.1.1 Xcode: 5.1.1 Osx: Mavericks(10.9.2) Device: Nexus 5 (4.4.2) An empty scrollableview does not get crash. Hence closing the issue.

JSON Source