Titanium JIRA Archive
Alloy (ALOY)

[ALOY-1242] Nested require with createController getView call causes crash on android

GitHub Issuen/a
TypeBug
PriorityMedium
StatusOpen
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
Componentsn/a
Labelsandroid
ReporterStefan Schüller
AssigneeTim Poulsen
Created2014-11-21T15:54:59.000+0000
Updated2015-02-11T22:20:11.000+0000

Description

How to reproduce:

make new alloy project

add the following files:

** controllers/index.js
$.index.open();
$.contentView.add(Alloy.createController('list').getView());
** controllers/list.js (empty) ** controllers/test.js (empty) ** views/index.xml
<Alloy>
    <Window id="index">
        <View id="contentView" />
    </Window>
</Alloy>
** views/list.xml
<Alloy>
    <Require src="test" />
</Alloy>
** views/test.xml
<Alloy>
    <View/>
</Alloy>
Same problem exists when doing this inside a Widget with and Widget.createController(). This code causes the following crash on starting the app on Android.
[ERROR] TiApplication: (main) [316,316] Sending event: exception on thread: main msg:java.lang.RuntimeException: Unable to start activity ComponentInfo{com.test/org.appcelerator.titanium.TiActivity}: java.lang.ClassCastException: java.util.HashMap cannot be cast to org.appcelerator.titanium.proxy.TiViewProxy; Titanium 3.4.1,2014/11/13 13:33,5982e8f
[ERROR] TiApplication: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.test/org.appcelerator.titanium.TiActivity}: java.lang.ClassCastException: java.util.HashMap cannot be cast to org.appcelerator.titanium.proxy.TiViewProxy
[ERROR] TiApplication: 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211)
[ERROR] TiApplication: 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
[ERROR] TiApplication: 	at android.app.ActivityThread.access$600(ActivityThread.java:141)
[ERROR] TiApplication: 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
[ERROR] TiApplication: 	at android.os.Handler.dispatchMessage(Handler.java:99)
[ERROR] TiApplication: 	at android.os.Looper.loop(Looper.java:137)
[ERROR] TiApplication: 	at android.app.ActivityThread.main(ActivityThread.java:5103)
[ERROR] TiApplication: 	at java.lang.reflect.Method.invokeNative(Native Method)
[ERROR] TiApplication: 	at java.lang.reflect.Method.invoke(Method.java:525)
[ERROR] TiApplication: 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
[ERROR] TiApplication: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
[ERROR] TiApplication: 	at dalvik.system.NativeStart.main(Native Method)
[ERROR] TiApplication: Caused by: java.lang.ClassCastException: java.util.HashMap cannot be cast to org.appcelerator.titanium.proxy.TiViewProxy
[ERROR] TiApplication: 	at org.appcelerator.titanium.proxy.TiViewProxy.setActivity(TiViewProxy.java:976)
[ERROR] TiApplication: 	at org.appcelerator.titanium.proxy.TiViewProxy.setActivity(TiViewProxy.java:977)
[ERROR] TiApplication: 	at ti.modules.titanium.ui.WindowProxy.windowCreated(WindowProxy.java:175)
[ERROR] TiApplication: 	at org.appcelerator.titanium.TiActivityWindows.windowCreated(TiActivityWindows.java:32)
[ERROR] TiApplication: 	at org.appcelerator.titanium.TiBaseActivity.windowCreated(TiBaseActivity.java:442)
[ERROR] TiApplication: 	at org.appcelerator.titanium.TiBaseActivity.onCreate(TiBaseActivity.java:524)
[ERROR] TiApplication: 	at org.appcelerator.titanium.TiActivity.onCreate(TiActivity.java:18)
[ERROR] TiApplication: 	at android.app.Activity.performCreate(Activity.java:5133)
[ERROR] TiApplication: 	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
[ERROR] TiApplication: 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)
[ERROR] TiApplication: 	... 11 more

Comments

No comments

JSON Source