The cordova.file in the Intel XDK Crosswalk compilations

I have uploaded files using Cordova File, Cordova FileTransfer and Cordova APIs and tested all of them in XDK app windows, but cordova.file

there is undefined inside the cordova walkway, I am using the same version and same code in windows assembly in Cordova (using cmd) and it works.

Intel XDK ver 1621

org.apache.cordova.file: 1.3.2

my html at the end of the body:

<script src="./cordova.js"></script>
<script src="./intelxdk.js"></script>
<script>
function onDeviceReady() {
   console.log(cordova.file);
   alert(cordova.file);
}
document.addEventListener("deviceready", onDeviceReady, false);
</script> 

      

Is there any other solution to get it cordova.file.dataDirectory

?

or can I just wait for another release to handle this?

+3


source to share


2 answers


For reference only:

org.apache.cordova.file

the version used in XDK (1621) is 1.1.0 and it doesn't cordova.file

, so I changed the plugin file version in XDK to 1.3.2 and no result since using the emulator or Debugger (using XDK Crosswalk app )

I'm pretty sure the File plugin is enabled using this method:

JSON.stringify(cordova.require('cordova/plugin_list').metadata, null, 1)

      

but emulator and debugger keep using version 1.1.0

Then I build it from the BUILD page in the XDK and it works and displays using version 1.3.2. The problem has been resolved.

I wish I had tried this before posting, but every time in my defense building I download it and then install it on the device takes as long as 20 minutes for each test, and it is not very logical.

Update emulator plugins

When I find out that the XDK is using the default version of plugins in the emulator, I decided to update the plugins manually in the XDK Folder on Windows:

%LOCALAPPDATA%\Intel\XDK\xdk\components\server\cordova-plugins

      

I just deleted the folder org.apache.cordova.file

and got a new clone from https://github.com/apache/cordova-plugin-file

to run my tests in the Emulator with an updated version.

Use updated plugins in Intel App Preview (this may cause issues with other tabs)



Just update the plugins in this folder on Windows:

%LOCALAPPDATA%\Intel\XDK\xdk\brackets\b\extensions\default\StaticServer\node\node_modules\cp\res\middleware\cordova\intel-app-preview\android\plugins

      

and the Debugger works well with updated plugins.


Simplify the update

Clone from git as in each folder:

In folder org.apache.cordova.file

git init && git remote add origin https://github.com/apache/cordova-plugin-file.git && git pull

      

you now have all versions in git.

To update all plugins, you can simply run this bash command in the root of the plugin: (on Windows, use git Bash)

for i in $(find $PWD -maxdepth 1 -type d); do echo $i && cd $i && git pull; done

      

+3


source


Are you sure you added a plugin? Try to build again and look at the build log. This sounds like a build-time bug that prevented the plugin from being added.



0


source







All Articles