Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-16257] Ti.UI.ScrollView.setScrollingEnabled results in Java Exception

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2017-10-25T18:56:02.000+0000
Affected Version/sn/a
Fix Version/sRelease 6.3.0
ComponentsAndroid
Labelsandroid, scrollview, ui
ReporterMauro Parra-Miranda
AssigneeJoshua Quick
Created2013-11-05T16:28:55.000+0000
Updated2017-10-26T22:15:29.000+0000

Description

Hi all, after upgrading to Alloy 1.2.2 Ti.UI.ScrollView.setScrollingEnabled results in and Uncaught Java Exception with no further details. Also, the same result happens if statically setting the property.
<Alloy>
	<ScrollView contentHeight="auto" contentWidth="auto" layout="vertical" height="Ti.UI.SIZE"></ScrollView>
</Alloy>
// Both of these return the same error
$.getView().setScrollingEnabled(true);
$.getView().scrollingEnabled = true;
Lee.

Comments

  1. Biju pm 2014-01-22

    PR:- https://github.com/appcelerator/titanium_mobile/pull/5244
  2. Joshua Quick 2017-10-24

    I'm able to reproduce this crash in a Classic App with the following lines of code in the "app.js" file
       var scrollView = Ti.UI.createScrollView({});
       scrollView.scrollingEnabled = true;
       
    And with the "tiapp.xml" file set up to not run on the main UI thread. _(This crash will never happen if running from the main thread.)_
       <?xml version="1.0" encoding="UTF-8"?>
       <ti:app xmlns:ti="http://ti.appcelerator.org">
           <property name="run-on-main-thread" type="bool">false</property>
       </ti:app>
       
    *Result:* The following exception gets outputted to the Android log...
       [ERROR] :  TiApplication: (main) [63,63] Sending event: exception on thread: main msg:java.lang.RuntimeException: Unable to start activity ComponentInfo{com.appcelerator.testing/com.appcelerator.testing.ClassicapptestActivity}: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.util.HashMap; Titanium 7.0.0,2017/10/23 15:17,undefined
       [ERROR] :  TiApplication: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.appcelerator.testing/com.appcelerator.testing.ClassicapptestActivity}: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.util.HashMap
       [ERROR] :  TiApplication: 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2665)
       [ERROR] :  TiApplication: 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
       [ERROR] :  TiApplication: 	at android.app.ActivityThread.-wrap12(ActivityThread.java)
       [ERROR] :  TiApplication: 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
       [ERROR] :  TiApplication: 	at android.os.Handler.dispatchMessage(Handler.java:102)
       [ERROR] :  TiApplication: 	at android.os.Looper.loop(Looper.java:154)
       [ERROR] :  TiApplication: 	at android.app.ActivityThread.main(ActivityThread.java:6119)
       [ERROR] :  TiApplication: 	at java.lang.reflect.Method.invoke(Native Method)
       [ERROR] :  TiApplication: 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
       [ERROR] :  TiApplication: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
       [ERROR] :  TiApplication: Caused by: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.util.HashMap
       [ERROR] :  TiApplication: 	at ti.modules.titanium.ui.ScrollViewProxy.handleMessage(ScrollViewProxy.java:107)
       [ERROR] :  TiApplication: 	at android.os.Handler.dispatchMessage(Handler.java:98)
       [ERROR] :  TiApplication: 	at org.appcelerator.kroll.common.TiMessenger.dispatchMessage(TiMessenger.java:394)
       [ERROR] :  TiApplication: 	at org.appcelerator.kroll.common.TiMessenger.dispatchPendingMessages(TiMessenger.java:379)
       [ERROR] :  TiApplication: 	at org.appcelerator.kroll.common.TiMessenger$2.getResult(TiMessenger.java:257)
       [ERROR] :  TiApplication: 	at org.appcelerator.kroll.common.TiMessenger.sendBlockingMessage(TiMessenger.java:291)
       [ERROR] :  TiApplication: 	at org.appcelerator.kroll.common.TiMessenger.sendBlockingRuntimeMessage(TiMessenger.java:191)
       [ERROR] :  TiApplication: 	at org.appcelerator.kroll.KrollProxy.callPropertySync(KrollProxy.java:725)
       [ERROR] :  TiApplication: 	at org.appcelerator.titanium.TiBaseActivity$4.run(TiBaseActivity.java:1203)
       [ERROR] :  TiApplication: 	at android.app.Activity.runOnUiThread(Activity.java:5866)
       [ERROR] :  TiApplication: 	at org.appcelerator.titanium.TiBaseActivity.dispatchCallback(TiBaseActivity.java:1200)
       [ERROR] :  TiApplication: 	at org.appcelerator.titanium.TiBaseActivity.onCreate(TiBaseActivity.java:687)
       [ERROR] :  TiApplication: 	at org.appcelerator.titanium.TiLaunchActivity.onCreate(TiLaunchActivity.java:169)
       [ERROR] :  TiApplication: 	at org.appcelerator.titanium.TiRootActivity.onCreate(TiRootActivity.java:161)
       [ERROR] :  TiApplication: 	at android.app.Activity.performCreate(Activity.java:6679)
       [ERROR] :  TiApplication: 	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
       [ERROR] :  TiApplication: 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2618)
       [ERROR] :  TiApplication: 	... 9 more
       
    *Cause:* There is message ID collision between the TiViewProxy and the ScrollViewProxy. The "MSG_FIRST_ID" should start from "TiViewProxy.MSG_LAST_ID", not "KrollProxy.MSG_LAST_ID"... https://github.com/appcelerator/titanium_mobile/blob/master/android/modules/ui/src/java/ti/modules/titanium/ui/ScrollViewProxy.java#L39
  3. Joshua Quick 2017-10-24

    PR (master): https://github.com/appcelerator/titanium_mobile/pull/9550 PR (6.3.x): https://github.com/appcelerator/titanium_mobile/pull/9551
  4. Lokesh Choudhary 2017-10-25

    FR passed for both master & backport PR.
  5. Lokesh Choudhary 2017-10-25

    Master PR merged. Waiting for 6.3.0 PR to get merge enabled.
  6. Lokesh Choudhary 2017-10-26

    PR for backport merged.
  7. Lokesh Choudhary 2017-10-26

    Verified the fix in SDK 6.3.0.v20171026120401 & 7.0.0.v20171025141436. Closing. Studio Ver: 4.10.0.201709271713 OS Ver: 10.12.3 Xcode Ver: Xcode 8.3.3 Appc NPM: 4.2.10-2 Appc CLI: 6.3.0-master.15 Ti CLI Ver: 5.0.14 Alloy Ver: 1.10.6 Node Ver: 7.10.1 Java Ver: 1.8.0_101 Devices: ⇨ google Nexus 5 — Android 6.0.1 ⇨ google Pixel — Android 7.1.1

JSON Source