Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-6371] Android: CommonJS apps crashing on android (V8 + Rhino) on Windows 7 / XP

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2012-01-05T10:29:11.000+0000
Affected Version/sRelease 1.8.0.1
Fix Version/sSprint 2011-48, Release 1.8.0.1
ComponentsAndroid
Labelsbranch-v8, dr-list, module_filesystem, qe-testadded
ReporterMatthew Apperson
AssigneeAllen Yeung
Created2011-11-29T19:09:20.000+0000
Updated2012-01-05T10:29:11.000+0000

Description

Expected Result:

A CommonJS project should build and run without build errors or runtime errors.

Actual Result:

Rhino and V8 crash every time with the following error:
TypeError: Cant use instance of a non-object. (Resources/app.js#4)

Steps to Reproduce:

Create a new project using 1.8.0.1 (V8 or Rhino), choose next (instead of finish).

Use the code below to create the app

Run the project (emulator or device) on a windows OS.

// This is a single context application with mutliple windows in a stack
(function() {

	var Window = require('ApplicationWindow').ApplicationWindow;
	
	new Window().open();
})();
//Application Window Component Constructor
exports.ApplicationWindow = function() {
	//create object instance
	var self = Ti.UI.createWindow();

	return self;
};

Attachments

FileDateSize
Resources.zip2011-11-29T19:09:20.000+0000746252

Comments

  1. Paul Dowsett 2011-12-01

    Tested and works without producing any exceptions on 1.8.0.1 with both engines:
         310          AndroidRuntime  D  >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
         310          AndroidRuntime  D  CheckJNI is ON
         310          AndroidRuntime  D  --- registering native functions ---
          60         ActivityManager  I  Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x
                                         10000000 cmp=timob6371.netaxiom.net/.Timob6371Activity }
          60         ActivityManager  I  Start proc timob6371.netaxiom.net for activity timob6371.netaxiom.net/.Timob6371Activity: pid=316 uid=10
                                         041 gids={1015, 3003}
         310          AndroidRuntime  D  Shutting down VM
         310          AndroidRuntime  I  NOTE: attach of thread 'Binder Thread #3' failed
         316           TiApplication  I  (main) [0,0] checkpoint, app created.
         316           TiApplication  I  (main) [653,653] Titanium 1.8.0.1 (2011/12/01 11:51 3359099)
         316              TiDbHelper  I  (main) [230,883] No value in database for platform key: 'unique_machine_id' returning supplied default '
                                         '
         316              TiDbHelper  I  (main) [11,894] No value in database for platform key: 'hardware_machine_id' returning supplied default 
                                         ''
         316        TiPlatformHelper  E  (main) [1,895] renaming ID
         316               TiFastDev  D  (main) [112,1007] Enabling Fastdev on port 41309
         316               TiFastDev  D  (main) [12,1019] sent tokens successfully
         316               TiFastDev  D  (main) [1,1020] Fastdev session handshake succesful.
         316           TiApplication  I  (main) [10,1030] Titanium Javascript runtime: rhino
         316          TiRootActivity  I  (main) [0,0] checkpoint, on root activity create, savedInstanceState: null
         316           TiAnalyticsDb  D  (main) [43,43] Creating Database tianalytics.db
         316           TiAnalyticsDb  I  (main) [3,46] Upgrading Database from 1 to 4
         316           TiApplication  E  (KrollRuntimeThread) [952,998] APP PROXY: ti.modules.titanium.app.AppModule@44f1f050
         316           TiAssetHelper  D  Fetching "app.js" with Fastdev...
         316                  Module  D  Loading module: ApplicationWindow -> Resources/ApplicationWindow.js
         316           TiAssetHelper  D  Fetching "ApplicationWindow.js" with Fastdev...
         316          TiRootActivity  I  (main) [0,0] checkpoint, on root activity resume. activity = timob6371.netaxiom.net.Timob6371Activity@44
                                         f1ff20
          60         ActivityManager  I  Displayed activity timob6371.netaxiom.net/.Timob6371Activity: 5796 ms (total 5796 ms)
         316          TiAnalyticsSvc  W  (Thread-12) [27475,27475] Analytics Service Started
         316          TiAnalyticsSvc  I  (Thread-12) [99,27574] Sending 2 analytics events.
         316          TiAnalyticsSvc  W  (Thread-12) [1256,28830] Stopping Analytics Service
       
         353          AndroidRuntime  D  >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
         353          AndroidRuntime  D  CheckJNI is ON
         353          AndroidRuntime  D  --- registering native functions ---
          60         ActivityManager  I  Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x
                                         10000000 cmp=timob6371.netaxiom.net/.Timob6371Activity }
          60         ActivityManager  I  Start proc timob6371.netaxiom.net for activity timob6371.netaxiom.net/.Timob6371Activity: pid=359 uid=10
                                         041 gids={1015, 3003}
         353          AndroidRuntime  D  Shutting down VM
         353          AndroidRuntime  I  NOTE: attach of thread 'Binder Thread #3' failed
         359           TiApplication  I  (main) [0,0] checkpoint, app created.
         359           TiApplication  I  (main) [622,622] Titanium 1.8.0.1 (2011/12/01 11:51 3359099)
         359               TiFastDev  D  (main) [188,810] Enabling Fastdev on port 41309
         359               TiFastDev  D  (main) [14,824] sent tokens successfully
         359               TiFastDev  D  (main) [1,825] Fastdev session handshake succesful.
         359           TiApplication  I  (main) [8,833] Titanium Javascript runtime: v8
         359          KrollV8Runtime  I  Loading emulator version of kroll-v8
         359          TiRootActivity  I  (main) [0,0] checkpoint, on root activity create, savedInstanceState: null
         359           TiApplication  E  (KrollRuntimeThread) [1142,1142] APP PROXY: ti.modules.titanium.app.AppModule@44f32748
         359           TiAssetHelper  D  Fetching "app.js" with Fastdev...
         359                  Module  D  Loading module: ApplicationWindow -> Resources/ApplicationWindow.js
         359           TiAssetHelper  D  Fetching "ApplicationWindow.js" with Fastdev...
         359           TypeConverter  W  jsValueToJavaObject returning null
         359          TiRootActivity  I  (main) [0,0] checkpoint, on root activity resume. activity = timob6371.netaxiom.net.Timob6371Activity@44
                                         f069e8
          60         ActivityManager  I  Displayed activity timob6371.netaxiom.net/.Timob6371Activity: 3469 ms (total 3469 ms)
         359          TiAnalyticsSvc  W  (Thread-12) [28536,28536] Analytics Service Started
         359          TiAnalyticsSvc  I  (Thread-12) [73,28609] Sending 1 analytics events.
       
  2. Paul Dowsett 2011-12-01

    Further clarification from Matt - this is a Windows-specific issue. Title and steps to reproduce have been amended. Previous tests were on Ubuntu. Tests on windows to follow.
  3. Allen Yeung 2011-12-02

    PR ready: https://github.com/appcelerator/titanium_mobile/pull/812 If you run into the error above, make sure you do a a full clean build before launching the emulator.
  4. Paul Dowsett 2011-12-02

    I have tested this on Windows 7, ensuring that the project was cleaned before launch. The following exception is generated, and "Uncaught TypeError: Cannot use 'in' operator to search for 'Resources/ApplicationWindow.js' in null" is displayed on the emulator:
    D/AndroidRuntime(  450): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
       D/AndroidRuntime(  450): CheckJNI is ON
       D/AndroidRuntime(  450): --- registering native functions ---
       I/ActivityManager(  101): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=net.netaxiom.timob6371/.Timob6371Activity }
       D/AndroidRuntime(  450): Shutting down VM
       D/jdwp    (  450): adbd disconnected
       I/ActivityManager(  101): Start proc net.netaxiom.timob6371 for activity net.netaxiom.timob6371/.Timob6371Activity: pid=457 uid=10040 gids={1015, 3003}
       D/dalvikvm(   33): GC_EXPLICIT freed 285 objects / 10816 bytes in 885ms
       D/dalvikvm(   33): GC_EXPLICIT freed 47 objects / 2080 bytes in 463ms
       I/TiApplication(  457): (main) [0,0] checkpoint, app created.
       D/dalvikvm(   33): GC_EXPLICIT freed 2 objects / 64 bytes in 332ms
       I/TiApplication(  457): (main) [231,231] Titanium 1.8.0.1 (2011/12/01 23:07 20399e2)
       D/TiFastDev(  457): (main) [157,388] Enabling Fastdev on port 50315
       D/TiFastDev(  457): (main) [28,416] sent tokens successfully
       D/TiFastDev(  457): (main) [1,417] Fastdev session handshake succesful.
       I/TiApplication(  457): (main) [11,428] Titanium Javascript runtime: v8
       I/KrollV8Runtime(  457): Loading emulator version of kroll-v8
       D/dalvikvm(  457): Trying to load lib /data/data/net.netaxiom.timob6371/lib/libkroll-v8-emulator.so 0x44ede4b0
       D/dalvikvm(  457): Added shared lib /data/data/net.netaxiom.timob6371/lib/libkroll-v8-emulator.so 0x44ede4b0
       D/dalvikvm(  457): GC_FOR_MALLOC freed 3697 objects / 345152 bytes in 116ms
       I/TiRootActivity(  457): (main) [0,0] checkpoint, on root activity create, savedInstanceState: null
       E/TiApplication(  457): (KrollRuntimeThread) [1505,1505] APP PROXY: ti.modules.titanium.app.AppModule@44f52cf0
       D/TiAssetHelper(  457): Fetching "app.js" with Fastdev...
       E/TiAssetHelper(  457): Error while reading asset "index.json":
       E/TiAssetHelper(  457): java.io.FileNotFoundException: index.json
       E/TiAssetHelper(  457):         at android.content.res.AssetManager.openAsset(Native Method)
       E/TiAssetHelper(  457):         at android.content.res.AssetManager.open(AssetManager.java:313)
       E/TiAssetHelper(  457):         at android.content.res.AssetManager.open(AssetManager.java:287)
       E/TiAssetHelper(  457):         at org.appcelerator.kroll.util.KrollAssetHelper.readAsset(KrollAssetHelper.java:55)
       E/TiAssetHelper(  457):         at org.appcelerator.kroll.runtime.v8.V8Runtime.nativeRunModule(Native Method)
       E/TiAssetHelper(  457):         at org.appcelerator.kroll.runtime.v8.V8Runtime.doRunModule(V8Runtime.java:59)
       E/TiAssetHelper(  457):         at org.appcelerator.kroll.KrollRuntime.handleMessage(KrollRuntime.java:206)
       E/TiAssetHelper(  457):         at org.appcelerator.kroll.runtime.v8.V8Runtime.handleMessage(V8Runtime.java:78)
       E/TiAssetHelper(  457):         at android.os.Handler.dispatchMessage(Handler.java:95)
       E/TiAssetHelper(  457):         at android.os.Looper.loop(Looper.java:123)
       E/TiAssetHelper(  457):         at org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:101)
       E/TiJSError(  457): (main) [512,2017] ----- Titanium Javascript Runtime Error -----
       E/TiJSError(  457): (main) [2,2019] - In module.js:258,21
       E/TiJSError(  457): (main) [3,2022] - Message: Uncaught TypeError: Cannot use 'in' operator to search for 'Resources/ApplicationWindow.js' in null
       E/TiJSError(  457): (main) [2,2024] - Source:   return filename in fileIndex;
       E/V8Exception(  457): Exception occurred at module.js:258: Uncaught TypeError: Cannot use 'in' operator to search for 'Resources/ApplicationWindow.js' in null
       I/TiRootActivity(  457): (main) [0,0] checkpoint, on root activity resume. activity = net.netaxiom.timob6371.Timob6371Activity@44f53d50
       I/ActivityManager(  101): Displayed activity net.netaxiom.timob6371/.Timob6371Activity: 6441 ms (total 6441 ms)
       D/dalvikvm(  336): GC_EXPLICIT freed 1937 objects / 140808 bytes in 157ms
       D/dalvikvm(  385): GC_EXPLICIT freed 273 objects / 18224 bytes in 131ms
       D/dalvikvm(  395): GC_EXPLICIT freed 800 objects / 56368 bytes in 150ms
       D/dalvikvm(  229): GC_EXPLICIT freed 693 objects / 39632 bytes in 171ms
       W/TiAnalyticsSvc(  457): (Thread-12) [27944,27944] Analytics Service Started
       I/TiAnalyticsSvc(  457): (Thread-12) [66,28010] Sending 1 analytics events.
       D/dalvikvm(  457): GC_FOR_MALLOC freed 5139 objects / 378168 bytes in 79ms
       D/dalvikvm(  457): GC_FOR_MALLOC freed 4409 objects / 236216 bytes in 62ms
       W/TiAnalyticsSvc(  457): (Thread-12) [1634,29644] Stopping Analytics Service
       
  5. Paul Dowsett 2011-12-02

    The following results are from an Ubuntu system. No exception is generated, or error in the emulator, but the message jsValueToJavaObject returning null is shown in the console (not sure if it's relevant to this windows issue, tho):
         437          AndroidRuntime  D  >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
         437          AndroidRuntime  D  CheckJNI is ON
          60     InputManagerService  W  Got RemoteException sending setActive(false) notification to pid 416 uid 10041
         437          AndroidRuntime  D  --- registering native functions ---
          60         ActivityManager  I  Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=timob6371.netaxiom.net/.Timob6371Activity }
          60         ActivityManager  I  Start proc timob6371.netaxiom.net for activity timob6371.netaxiom.net/.Timob6371Activity: pid=443 uid=10041 gids={1015, 3003}
         437          AndroidRuntime  D  Shutting down VM
         443           TiApplication  I  (main) [0,0] checkpoint, app created.
         443           TiApplication  I  (main) [199,199] Titanium 1.8.0.1 (2011/12/01 23:07 20399e2)
         443               TiFastDev  D  (main) [153,352] Enabling Fastdev on port 43011
         443               TiFastDev  D  (main) [9,361] sent tokens successfully
         443               TiFastDev  D  (main) [1,362] Fastdev session handshake succesful.
         443           TiApplication  I  (main) [8,370] Titanium Javascript runtime: v8
         443          KrollV8Runtime  I  Loading emulator version of kroll-v8
         443          TiRootActivity  I  (main) [0,0] checkpoint, on root activity create, savedInstanceState: null
          60     NotificationService  W  Object died trying to hide notification android.app.ITransientNotification$Stub$Proxy@450037e0 in package timob6371.netaxiom.net
          60         ActivityManager  W  setProcessForeground called on unknown pid: 416
         443           TiApplication  E  (KrollRuntimeThread) [1062,1062] APP PROXY: ti.modules.titanium.app.AppModule@44f79e40
         443           TiAssetHelper  D  Fetching "app.js" with Fastdev...
         443                  Module  D  Loading module: ApplicationWindow -> Resources/ApplicationWindow.js
         443           TiAssetHelper  D  Fetching "ApplicationWindow.js" with Fastdev...
         443           TypeConverter  W  jsValueToJavaObject returning null
         443          TiRootActivity  I  (main) [0,0] checkpoint, on root activity resume. activity = timob6371.netaxiom.net.Timob6371Activity@44f66938
          60         ActivityManager  I  Displayed activity timob6371.netaxiom.net/.Timob6371Activity: 3278 ms (total 3278 ms)
         443          TiAnalyticsSvc  W  (Thread-12) [28585,28585] Analytics Service Started
         443          TiAnalyticsSvc  I  (Thread-12) [67,28652] Sending 1 analytics events.
         443          TiAnalyticsSvc  W  (Thread-12) [1271,29923] Stopping Analytics Service
       
  6. Dustin Hyde 2011-12-06

    Bug fixed. Verified on: SDK: 1.8.0.1.v20111206151102 Runtimes: Android V8/Rhino Studio: 1.0.7.201112060130 OS: Windows 7 Devices Tested: Nexus One 2.2.2, Droid3 2.3.4, G-Slate 3.1, Android Emulator 4.0
  7. Dustin Hyde 2012-01-05

    Added label qe-testadded.

JSON Source