[TIMOB-16619] Android: LiveView throws errors if action bar is implemented in the app
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2015-09-10T03:09:36.000+0000 |
Affected Version/s | Release 3.3.0 |
Fix Version/s | Release 5.1.0 |
Components | Android, LiveView |
Labels | merge-4.1.1, qe-nfc |
Reporter | Lokesh Choudhary |
Assignee | Feon Sua Xin Miao |
Created | 2014-03-12T23:10:30.000+0000 |
Updated | 2015-10-21T22:40:08.000+0000 |
Description
NOTE : This is seen on post & pre 3.0 android devices & emulators.
Description:
1. Create a default & replace the app.js with the sample code for action bar from the docs:
var win = Ti.UI.createWindow({
title: "Old Title",
navBarHidden: false
});
var actionBar;
win.addEventListener("open", function() {
if (Ti.Platform.osname === "android") {
if (! win.activity) {
Ti.API.error("Can't access action bar on a lightweight window.");
} else {
actionBar = win.activity.actionBar;
if (actionBar) {
actionBar.backgroundImage = "/bg.png";
actionBar.title = "New Title";
actionBar.onHomeIconItemSelected = function() {
Ti.API.info("Home icon clicked!");
};
}
}
}
});
win.open();
2. Build for android device/emulator with live view enabled.
Actual Result:
1. We see following error in console:
[INFO] : [LiveView] Error Evaluating app.js @ Line: undefined
[ERROR] : ReferenceError: actionBar is not defined
[ERROR] : File: app.js
[ERROR] : Line: undefined
[ERROR] : SourceId: undefined
[ERROR] : Backtrace:
[ERROR] : undefined
We'd like to try fixing this for 3.3.0. Possible?
Considering the limited use case (this issue will surface only when a variable is not initialized to any value, even null/undefined and defined only in the higher scope), we can defer it to the future versions - may be, for 3.4.0 release.
PR: https://github.com/appcelerator/liveview/pull/90
Merged into master.
Verified the fix. No errors are seen using liveview if action bar is implements in the app. Closing. Environment: Appc Studio : 4.3.3.201510201834 Ti SDK : 5.1.0.v20151020095222 Ti CLI : 5.0.5 Alloy : 1.7.16 MAC Yosemite : 10.10.5 Appc NPM : 4.2.1-5 Appc CLI : 5.1.0-38 Node: v0.10.37 Nexus 5 - Android 6.0 Android Emulator: android 4.4.4, android 4.1.1