Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-4895] Android: JSS not working

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2011-12-16T09:30:31.000+0000
Affected Version/sRelease 1.7.1
Fix Version/sRelease 1.8.0.1
ComponentsAndroid
Labelsn/a
ReporterPaul Dowsett
AssigneeDon Thorp
Created2011-08-05T04:07:29.000+0000
Updated2014-06-19T12:46:32.000+0000

Description

JSS does not work for me for any versions of the Titanium SDK. The following code may be used to reproduce the issue (taken from the [Cross-platform layout using JSS](http://wiki.appcelerator.org/display/guides/Designing+the+User+Interface#DesigningtheUserInterface-CrossplatformlayoutusingJSS) guide). Note that a full rebuild was performed between jss changes:
var window = Ti.UI.createWindow({
	id:"w"
});
var button = Ti.UI.createButton({
	id:"button",
	title:"Hello",
	className:"b"
});
window.add(button);
window.open();
#w {
	background-color:'#0f0';
}
button {
	width:'200';
}
.b {
	height:'100';
}
  382          AndroidRuntime  D  >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
  382          AndroidRuntime  D  CheckJNI is ON
   53           WindowManager  I  WIN DEATH: Window{44d79978 com.testing.testing7/com.testing.testing7.Testing7Activity paused=false}
   53         ActivityManager  I  Process com.testing.testing7 (pid 361) has died.
   53              UsageStats  I  Unexpected resume of com.android.launcher while already resumed in com.testing.testing7
   53     InputManagerService  W  Got RemoteException sending setActive(false) notification to pid 361 uid 10030
  382          AndroidRuntime  D  --- registering native functions ---
  382                ddm-heap  D  Got feature list request
   53         ActivityManager  I  Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x
                                  10000000 cmp=com.testing.testing7/.Testing7Activity }
   53         ActivityManager  I  Start proc com.testing.testing7 for activity com.testing.testing7/.Testing7Activity: pid=388 uid=10030 g
                                  ids={1015, 3003}
  382          AndroidRuntime  D  Shutting down VM
  382                dalvikvm  D  DestroyJavaVM waiting for non-daemon threads to exit
  382                dalvikvm  D  DestroyJavaVM shutting VM down
  382                dalvikvm  D  HeapWorker thread shutting down
  382                dalvikvm  D  HeapWorker thread has shut down
  382                    jdwp  D  JDWP shutting down net...
  382                dalvikvm  I  Debugger has detached; object registry had 1 entries
  382                dalvikvm  D  VM cleaning up
  382          AndroidRuntime  E  ERROR: thread attach failed
  382                dalvikvm  D  LinearAlloc 0x0 used 638596 of 5242880 (12%)
  388                ddm-heap  D  Got feature list request
  388           TiApplication  I  (main) [0,0] checkpoint, app created.
  388                dalvikvm  D  GC freed 2828 objects / 313816 bytes in 53ms
  388           TiApplication  I  (main) [392,392] Titanium 1.7.3 (2011/08/01 09:23 )
  388            TiDeployData  D  (main) [39,431] Read deploy data: {"debuggerPort":-1,"debuggerEnabled":false,"fastdevPort":44619}
  388        TiPlatformHelper  E  (main) [33,464] platformId is null, setting to empty string
  388              TiDbHelper  I  (main) [24,488] No value in database for platform key: 'unique_machine_id' returning supplied default ''
                                  
  388              TiDbHelper  I  (main) [12,500] No value in database for platform key: 'hardware_machine_id' returning supplied default 
                                  ''
  388          TiRootActivity  I  (main) [0,0] checkpoint, on root activity create, savedInstanceState: null
  388           TiApplication  E  (main) [207,207] APP PROXY: [Ti.App]
  388     TiCommonContactsApi  D  (main) [15,222] Using newer contacts api.  Android SDK level: 7
  388                dalvikvm  D  GC freed 5554 objects / 427296 bytes in 50ms
  388                  global  I  Default buffer size used in BufferedReader constructor. It would be better to be explicit if an 8k-char 
                                  buffer is required.
  388               TiFastDev  D  (kroll$1: app://app.js) [385,607] Enabling Fastdev on port 44619
  388               TiFastDev  D  (kroll$1: app://app.js) [9,616] sent tokens successfully
  388               TiFastDev  D  (kroll$1: app://app.js) [2,618] Fastdev session handshake succesful.
  388                dalvikvm  D  GC freed 8119 objects / 558904 bytes in 57ms
  388            KrollContext  D  (kroll$1: app://app.js) [115,733] Running evaluated script: file:///android_asset/Resources/app.js
  388                dalvikvm  D  GC freed 1239 objects / 98384 bytes in 48ms
  388          TiRootActivity  I  (main) [0,0] checkpoint, on root activity resume. context = org.appcelerator.titanium.TiContext@44ec1838
                                  
  388          TiAnalyticsSvc  W  (Thread-12) [30,30] Analytics Service Started
   53         ActivityManager  I  Displayed activity com.testing.testing7/.Testing7Activity: 2382 ms (total 2382 ms)
  388          TiAnalyticsSvc  I  (Thread-12) [391,421] Sending 1 analytics events.
   53     NotificationService  W  Object died trying to hide notification android.app.ITransientNotification$Stub$Proxy@44e94d50 in packag
                                  e com.testing.testing7
   53         ActivityManager  W  setProcessForeground called on unknown pid: 361
  388                dalvikvm  D  GC freed 7363 objects / 439568 bytes in 62ms
  388          TiAnalyticsSvc  W  (Thread-12) [1323,1744] Stopping Analytics Service
   96                dalvikvm  D  GC freed 199 objects / 8712 bytes in 65ms
I also tried the following jss, with the dimensions as numbers rather than strings, with the same results:
#w {
	background-color:'#0f0';
}
button {
	width:200;
}
.b {
	height:100;
}
and using camelCase:
#w {
	backgroundColor:'#0f0';
}
button {
	width:200;
}
.b {
	height:100;
}
This is the result: !http://img714.imageshack.us/img714/5595/screenshot316b.png|width=300! Note there has also been a report from another user that no pixel definitions work when used *in classes*, for example: * width: 100; * width: '100px'; * width: 100px; This is also demonstrated in the code above, using the *.b* class. Would you check that these work too after the fix is applied?

Comments

  1. Paul Dowsett 2011-12-16

    This issue has been resolved. Please close at your discretion! ;) Using: * Titanium SDK version: 1.8.0.1 (12/16/11 01:01 61086c9) * Android APIs 2.2 * emulator
       /* works correctly */
       #w {
       	background-color:'#00f';
       }
       
       /* works correctly including orientation - ids override classes when set on the same objects */
       #button {
       	height:'200';
       	width:'400';
       }
       
       /* works correctly including orientation */
       .b {
       	height:'60%';
       	width:'80%';
       }
       
       /* works correctly including orientation (integers as strings interpreted as px) */
       /*.b {
       	height:'300';
       	width:'400';
       }*/
       
       /* works correctly including orientation (integers interpreted as px) */
       /*.b {
       	height:300;
       	width:400;
       }*/
       
  2. Paul Dowsett 2011-12-16

    Closing, with Don's blessing! :)

JSON Source