Sencha touch with a telephone connection (using sencha cmd and the phonegap assembly) raises an error: LocalFileSystem not defined

I followed this sencha cmd tutorial to create a phone-based sencha touch 2 project: Using the latest Sencha Cmd v4.0.2.67, the latest sencha touch 2.3.1, phoneGap ver-3.1.0

1) Make a sencha touch 2 project:

sencha -sdk /path/to/sencha-touch-sdk generate app MyApp /path/to/www/myapp 

2) Add phoneGap to the above project

 sencha phonegap init 

3) configure phonegap.local.properties

 phonegap.platform=android phonegap.build.remote=true phonegap.build.remote.username=myUseName phonegap.build.remote.password=myPassword 

4) Updated config.xml file, adding all the main plugins

 <!-- Core plugins --> <gap:plugin name="org.apache.cordova.battery-status" /> <gap:plugin name="org.apache.cordova.camera" /> <gap:plugin name="org.apache.cordova.media-capture" /> <gap:plugin name="org.apache.cordova.console" /> <gap:plugin name="org.apache.cordova.contacts" /> <gap:plugin name="org.apache.cordova.device" /> <gap:plugin name="org.apache.cordova.device-motion" /> <gap:plugin name="org.apache.cordova.device-orientation" /> <gap:plugin name="org.apache.cordova.dialogs" /> <gap:plugin name="org.apache.cordova.file" /> <gap:plugin name="org.apache.cordova.file-transfer" /> <gap:plugin name="org.apache.cordova.geolocation" /> <gap:plugin name="org.apache.cordova.globalization" /> <gap:plugin name="org.apache.cordova.inappbrowser" /> <gap:plugin name="org.apache.cordova.media" /> <gap:plugin name="org.apache.cordova.network-information" /> <gap:plugin name="org.apache.cordova.splashscreen" /> <gap:plugin name="org.apache.cordova.vibration" /> 

and removed the permission configuration <preference name="permissions" value="none"/>

5) Created an external js file called dirReader.js and included its path in app.json

dirReader.js Contents

 window.onerror=function(msg, url, linenumber){ alert('Error message: '+msg+'\nURL: '+url+'\nLine Number: '+linenumber) return true } var dirList = [{name: 'Chart 1'},{name: 'Chart 2'}]; // Wait for device API libraries to load // document.addEventListener("deviceready", onDeviceReady, false); // device APIs are available // function onDeviceReady() { alert("device ready"); Ext.device.FileSystem.requestFileSystem( LocalFileSystem.PERSISTENT, 0, function(fs) { // LocalFileSystem not defined error here alert("Root = " + fs.root.fullPath); var directoryReader = fs.root.createReader(); directoryReader.readEntries(function(entries) { var i; for (i=0; i<entries.length; i++) { //alert(entries[i].name); var itemObj = {}; itemObj.name = entries[i].name; dirList.push(itemObj); } var dirListString = JSON.stringify(dirList); alert(dirListString); }, function (error) { alert(error.code); }) }, function (error) { alert(error.code); }); } 

6) Added 'Ext.device.FileSystem' to the request in app.js

7) Finally ran sencha app build native This makes a lot of mumbo jumbo go through the command line (No Errors). The application is compressed and loaded into build.phonegap to build Android. Build completed successfully.

-------------------------------------------- ------ --------------------------------------

PROBLEM

The application installs and starts normally. I get a โ€œDevice Readyโ€ warning from the dirReader.js file. The next error I get is that LocalFileSystem is undefined in dirReader.js.

I tried a lot of things but nothing works.

I checked that the built-in apk contains a plugins folder with all plugins, including org.apache.cordova.file . In addition, cordova_plugins.js is present and has a window.LocalFileSystem entry.

+1
source share
1 answer

I saw the same problem somewhere .. is cordova_plugin.js contain

 { "file": "plugins/org.apache.cordova.core.file/www/FileSystem.js", "id": "org.apache.cordova.core.file.FileSystem", "clobbers": [ "window.FileSystem" ] }, 

Have you tried building with> cordova build android

can you call any other API method?

+2
source

All Articles