Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-2000] Android: Module name collision between Ti.UI.Android and Ti.Android

GitHub Issuen/a
Resolution Date2011-04-17T01:57:47.000+0000
Affected Version/sn/a
Fix Version/sRelease 1.5.0 M01
Labelsandroid, defect
ReporterBill Dawson
AssigneeBill Dawson


If you run this app.js:

/*global Ti, Titanium, alert, JSON */
Ti.API.info('Ti.Android.ACTION_ALL_APPS = ' + Ti.Android.ACTION_ALL_APPS);

The result should be:

I/TiAPI   ( 1127): (kroll$1) [1,147] Ti.UI.Android.SOFT_INPUT_ADJUST_PAN = 32
I/TiAPI   ( 1127): (kroll$1) [0,169] Ti.Android.ACTION_ALL_APPS = android.intent.action.ALL_APPS

But the actual result is:

I/TiAPI   ( 1127): (kroll$1) [1,147] Ti.UI.Android.SOFT_INPUT_ADJUST_PAN = 32
I/TiAPI   ( 1127): (kroll$1) [0,169] Ti.Android.ACTION_ALL_APPS = null

The second one fails because KrollObject.get() grabs the cached module named Android, which comes from Ti.UI.Android since it was called first.


  1. Bill Dawson 2011-04-15

    (from [3f1d49ee52fb480288b9ef8ddedbed18b94a4f65]) [#2000 state:fixed-in-qa] Caching of modules now uses their full qualified class names as keys to avoid collisions between Ti.Android and Ti.UI.Android http://github.com/appcelerator/titanium_mobile/commit/3f1d49ee52fb480288b9ef8ddedbed18b94a4f65"> http://github.com/appcelerator/titanium_mobile/commit/3f1d49ee52fb4...

  2. Thomas Huelbert 2011-04-15

    Hey Bill, I am seeing :

    I/TiAPI ( 299): (kroll$3) [99,29737] Ti.UI.Android.SOFT_INPUT_ADJUST_PAN = 32
    I/TiAPI ( 299): (kroll$3) [2,29739] Ti.Android.ACTION_ALL_APPS = undefined

    in Titanium SDK version: 1.5.0d02c264

  3. Marshall Culpepper 2011-04-15

    Adding Don's comment from the duplicate #2142:
    Ti.UI.Android and Ti.Android are not detected as separate namespaces. If both modules are included in boot, and Ti.UI.Android is added last, calling Ti.Android.createActivity throws an exception because it's looking in the Ti.UI.Android module

  4. Bill Dawson 2011-04-15

    (from [b42c84f0441aca59872f3c2bec07abb02afb2965]) [#2000 state:fixed-in-qa] third-level modules should not be included in Application.java (and thus not in app_modules collection in android.py). They are bound lazily at runtime. https://github.com/appcelerator/titanium_mobile/commit/b42c84f0441aca59872f3c2bec07abb02afb2965"> https://github.com/appcelerator/titanium_mobile/commit/b42c84f0441a...

  5. Bill Dawson 2011-04-15

    (from [98da99d5801e426ff5cc63555b6a398ec662a5eb]) [#2000 state:fixed-in-qa] add unit test https://github.com/appcelerator/titanium_mobile/commit/98da99d5801e426ff5cc63555b6a398ec662a5eb"> https://github.com/appcelerator/titanium_mobile/commit/98da99d5801e...

  6. Matt Schmulen 2011-04-15

    Titanium SDK version: 1.5.0 (12/01/10 09:30 ac7cfd8), drillbit, Android 1.6/2.1

JSON Source