KitKat upgrade, application doesn't load properly on first open, have to close/reopen a few times.

38 views
Skip to first unread message

Fahim Ali

unread,
Nov 18, 2014, 3:34:36 PM11/18/14
to phon...@googlegroups.com
Hello,

My application is malfunctioning when deployed to KitKat devices. It was working fine on pre KitKat. If I close the app and reopen it a couple of times it seems to open up but I still see many errors in Logcat. I recently upgraded to Cordova 3.6, if that helps.

I've attached a log of what I was seeing. This was seen on a Samsung Galaxy Tab 3 device, although I was seeing the same issue on an emulated KitKat device (albeit, without the error messages, so that is even harder to explain).
log.txt

Kerri Shotts

unread,
Nov 19, 2014, 12:48:10 AM11/19/14
to phon...@googlegroups.com
Looks to me like your issues are with your file handling. This error in particular stands out: 

11-18 12:16:49.844: W/System.err(7834): java.io.FileNotFoundException: path does not exist
11-18 12:16:49.854: W/System.err(7834): 	at org.apache.cordova.file.LocalFilesystem.getFileForLocalURL(LocalFilesystem.java:194)
11-18 12:16:49.854: W/System.err(7834): 	at org.apache.cordova.file.FileUtils.getFile(FileUtils.java:764)
11-18 12:16:49.864: W/System.err(7834): 	at org.apache.cordova.file.FileUtils.access$6(FileUtils.java:757)
11-18 12:16:49.864: W/System.err(7834): 	at org.apache.cordova.file.FileUtils$17.run(FileUtils.java:412)
11-18 12:16:49.864: W/System.err(7834): 	at org.apache.cordova.file.FileUtils$24.run(FileUtils.java:540)
11-18 12:16:49.864: W/System.err(7834): 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
11-18 12:16:49.864: W/System.err(7834): 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
11-18 12:16:49.864: W/System.err(7834): 	at java.lang.Thread.run(Thread.java:841)
11-18 12:16:49.894: D/[REDACTED](7834): ORDER BY: 
11-18 12:16:50.494: D/UserManager(7834): _initXmlDocument: Exception: /storage/emulated/0/[REDACTED]/systeminfo/system/users.tac: open failed: ENOENT (No such file or directory)

If you're hard-coding any paths, 4.4 might have those in a different location, and thus generate that error. But that's just a guess. It's hard to tell without some code.

When the app /finally/ works, does it work consistently thereafter, or is it intermittent?  What is displayed when the app malfunctions? A blank screen, an error, etc.?

Fahim Ali

unread,
Nov 19, 2014, 10:14:00 AM11/19/14
to phon...@googlegroups.com
Hi Kerri,

Those file handling exceptions are expected. I did not experience this issue on Phonegap 1.3 (which I was on prior to upgrading Cordova 3.6... ancient, I know) and KitKat, or on Cordova 3.6 and a pre KitKat device.

It seems like Cordova is failing to load the plugins. The plugins are listed correctly in the config.xml file. The app works intermittently, I have to exit and re-enter the app several times to get it to work. When the app doesn't work, it only loads some of the HTML from the "index.html" file. Some plugins need to be loaded and that is when the problems start, which can be seen by this line:

11-18 12:16:18.404: D/CordovaLog(7834): file:///android_asset/www/JS/Lib/ViewManager.js: Line 161 : Uncaught ReferenceError: Helper_Plugin is not defined

In the onLoad function in "index.html", I am loading the plugin like so: Helper_Plugin = cordova.require("cordova/plugin/Helper_Plugin");

I wonder if that onLoad function is not called before the "UncaughtReferenceError"?

Kerri Shotts

unread,
Nov 20, 2014, 10:53:29 PM11/20/14
to phon...@googlegroups.com
What in the world is the Helper Plugin?

If it's a normal phonegap plugin, it will be loaded by the time deviceready is called. Now that will probably be a while after onload, so don't execute any code that needs Cordova or plugin features until you receive deviceready.

Fahim Ali

unread,
Nov 21, 2014, 9:04:55 AM11/21/14
to phon...@googlegroups.com
Kerri,

Wow! I can't believe I didn't think of this earlier. I was trying to call "cordova.require" on my own plugins before the "deviceready" event. Once I moved the "cordova.require" bits to the "deviceready" event handler it's working like a charm. Thank you very much!
Reply all
Reply to author
Forward
0 new messages